note 13664 deleted from function.array by irc-html

From: Date: Sat, 19 Jan 2002 20:55:14 +0000
Subject: note 13664 deleted from function.array by irc-html
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-25434@lists.php.net to get a copy of this message
here is a nice example of a multidimentional array. some people like to call them hash tables (it's a matrix). either way here's how they work. <? $foo = array('fruit' => array('yellow' => 'banana', 'orange' => 'orange', 'purple' => 'plumb'), 'flower' => array('yellow' => 'sun flower', 'red' => 'rose', 'purple' => 'iris')); echo"<form name=\"pick\" action=\"$PHP_SELF\"> <font face=\"Verdana, Arial\" size=\"2\">Type? <input type=\"text\" name=\"type\"> Color? <input type=\"text\" name=\"color\"> <input type=\"submit\" name=\"submit\" value=\"hit it!\"> <br>"; echo"last pick = " . $foo[$type][$color]; /*type indicates the first level array & color the second. it's really simple. pick fruit as the type and purple as the color and you'll always get plumb as the answer */ ?> «°»

« previous php.notes (#25434) next »