how to initialize a PHP bidimensional array -


let's manage multidimensional array (pseudo-code):

array $colors * wine,red * cheese,yellow * apple, green * pear,brown 

what code used avoid following notation, initialize array (assuming there hard-coded list of elements=?:

$colors[x][y] = 'something'; 

$array = array(    array('wine', 'red'),    array('cheese', 'yellow'),    array('apple', 'green'),    array('pear', 'brown') ); 

upd:

foreach ($array $v) {    echo $v[0]; // wine, cheese...    echo $v[1]; // red, yellow... } 

Comments

Popular posts from this blog

ASP.NET/SQL find the element ID and update database -

jquery - appear modal windows bottom -

c++ - Compiling static TagLib 1.6.3 libraries for Windows -