A while back I was trying to use PHP's get_browser function, which should return an array of information. It takes the visitor's user agent value and parses it to do this. It turns out that in order to use get_browser you must have browscap configured correctly in your php.ini file. In my case this wasn't really an option since the server I was working on does not allow access to the ini file.
So, if you find yourself in a similar case then the best option will be to parse the user agent yourself.
-
Custom Get Browser Function in PHP
2 Comments Posted on September 23rd, 2009Read More › -
Utilizing PHP's Trim
1 Comment Posted on September 16th, 2009Read More ›PHP's trim() is often underused. Usually web developers throw it in simply to prevent leading and trailing white spaces, but that's about it. What a lot of people seem to overlook is the fact that there is an optional second parameter which can make things a whole lot more useful.
A simple use of trim() would be something like this$s = " There are some white spaces around me ";
echo trim($s);
You can expect that this will result in "There are some white spaces around me." Pretty simple. Now, let's assume that you are looping through an array of strings and have produced a single comma separated string.