Search This Blog

multi dimensional arrays in php

<?php


$birds= array('Parrots' =>
array('Kakapo','Kea ','Vernal Hanging Parrot'),

'Cuckoos and Turacos'=>
array('Purple-crested Turaco','Grey Go-away-bird','Great Blue Turaco'));

print_r($birds);

echo '<br><br><br>';

echo $birds['Parrots'][0].'<br>';
echo $birds['Parrots'][1].'<br>';
echo $birds['Parrots'][2].'<br>';


echo '<br><br><br>';

echo $birds['Cuckoos and Turacos'][0].'<br>';
echo $birds['Cuckoos and Turacos'][1].'<br>';
echo $birds['Cuckoos and Turacos'][2].'<br>';


?>


output :
Array ( [Parrots] => Array ( [0] => Kakapo [1] => Kea [2] => Vernal Hanging Parrot ) [Cuckoos and Turacos] => Array ( [0] => Purple-crested Turaco [1] => Grey Go-away-bird [2] => Great Blue Turaco ) )


Kakapo
Kea
Vernal Hanging Parrot



Purple-crested Turaco
Grey Go-away-bird
Great Blue Turaco


Share Links

Related Posts Plugin for WordPress, Blogger...