Multi dimension arrays

php Add comments

$colors=array(
  array("red","rgb(255,0,0)"),
  array("yellow","rgb(255,255,0)"),
  array("green","rgb(0,255,0)"),
  array("blue","rgb(0,0,255)")
  );
echo $colors[0][0];
echo " - ";
echo $colors[0][1];
echo "<br/>";

This really makes clear to us that what we are creating is in fact an array of arrays.
The output is: red - rgb(255,0,0)

Leave a Reply

You must be logged in to post a comment.

WebSite Powered by webHauser
Entries RSS Comments RSS Login