[plug] PHP Arrays

skribe skribe at amber.com.au
Mon Sep 11 17:06:36 WST 2000


At 13:35 11/09/00, SweenyTod wrote:
>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.

Yep.  All done.  The array works.  Extracting individual elements from the 
array don't.  Either my formatting is somehow up the duff or there is a bug 
in 4.0.2.

I haven't played with extracting individual info from arrays before so 
there is every chance that I'm doing something wrong.  What I'm trying to 
do is fairly basic and could easily be done with just $http_user_agent.  I 
wanted to play with get_browser() to see if I could use it for something a 
little more complicated.  It seems not =).

Unfortunately the manual is of little use in this case.  I spent several 
hours yesterday bashing my head against this, searching through the manual, 
the errata and the otherwise very good book, Professional PHP Programming, 
all to no avail.  There seems to be plenty of info about how to cycle 
through the data in an array but very little on how to extract individual 
elements beyond the first or last.

I have no doubt, however, that Leon will commend to me the specific page in 
the manual about extracting individual elements from an array, though =).


skribe
	Purity:                           62.0% 			
	Corruption:                    38.0%	
	Insanity:                        36.3636363636364%
	Weirdness factor:           31%
	Experience Level:           JonKatz Wannabe
	Medieval Career:            Black Knight	




More information about the plug mailing list