Jump to content

Echo Array Value


unemployment

Recommended Posts

one dimension array:

$array = array("t", "r", "s");
echo $array[0];
foreach ($array as $a) {echo $a;}

array with keys

$array = array("t" => "1", "r" => "2", "s" => "3");
echo $array[t];//1
foreach ($array as $key => $val) {echo "Key is $key, Val is $val";}

two dimensional array:

$array = array(array("it", "is"), array("starting", "to"), array("get", "complicated"));
echo $array[0][0];//it
foreach ($array as $a) {echo $a[1];//is, to, complicated
foreach ($a as $b) {echo $b;}//gives u all output
}

Ted

Link to comment
https://forums.phpfreaks.com/topic/233167-echo-array-value/#findComment-1199253
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.