[plug] PHP Arrays

SweenyTod sweenytod at sweenytod.com
Mon Sep 11 13:35:38 WST 2000


At 01:14 PM 11/09/2000, you wrote:
>At 13:06 11/09/00, Carl Gherardi wrote:
>>On Mon, 11 Sep 2000, Jason :) wrote:
>>
>> > on line 5 in that code, try:
>> > $value=$browser["browser"];
>> >
>> > PHP seems to like having quotation marks in its array element name 
>> thingy...
>> >
>>Or if browser in line 5 is a variable then
>>$value=$browser[$variable];
>>
>>I've forgotten $ signs way to many times previously...
>
>Unfortunately, none of those solutions made any difference.  Does it work 
>for anyone else?  I'm using php-4.02 - from the latest set of 
>rpms.  Perhaps there's a bug.

Sorry if this has already been said, but I haven't been following this 
thread.  In order for get_browser() to work, you need the browsercap.ini 
file.  This is, from what I can gather, a browser version of termcap.  PHP 
reads $HTTP_USER_AGENT to find out what browser you've got, and then sucks 
the info out of browsercap.ini to populate the array.  If the file isn't 
there, then the array will be empty.

Try http://www.cyscape.com/asp/browscap/ for the file, install it and then 
try again.  The PHP FAQ talks about this.

Of course, $HTTP_USER_AGENT might return the information you're 
after.  Mine shows this:

Mozilla/4.0 (compatible; MSIE 5.01; Windows NT 5.0)

 From that I can tell most information about the client's browser that I'd 
need to.  Operating system and version of IE is there, if you're prepared 
to parse the info.



=============================================================
Attend the tale of Sweeney Todd.    His skin was pale and his eye was odd.
Always trust an Australian with a razor.

http://www.sweenytod.com               Paranoid is normal, normal is good




More information about the plug mailing list