[thelist] PHP: Associative Arrays

Donald Noble donald at drnoble.co.uk
Fri Jun 28 15:52:02 CDT 2002


Hi evolters,

If I have an array set up as follows:

$people = array(
	"Joe" => array ( "sname" => "Blogs", "age" => "32", "hates" =>
"bananas"),
	"Mick" => array ( "sname" => "Mouse", "age" => "4", "hates" =>
"cats"),
	"Dave" => array ( "sname" => "Brown", "age" => "22", "hates" =>
"me")
);

how (if possible) can I check if there is an entry for Joe? ie I would
like to use something similar to if(in_array("Joe"),$people)...

the other question I have is, is there any way to easily get the
previous and next entries in such an array?

Cheers :Donald

--
     http://www.AccessibleComputers.co.uk
 Hardware, Software & Custom built PC Systems





More information about the thelist mailing list