Search This Blog

associative arrays in php

<?php

$alphabate=array('A'=>'APPLE','a'=>'apple','B'=>'BALL','b'=>'ball','C'=>'CAT','c'=>'cat','D'=>'DOLL','d'=>'doll','E'=>'ELEPHANT','e'=>'elephant');


print_r($alphabate);

// '<BR>' USE FOR NEW LINE
// 'A' is not equal to 'a' in arrays index
// '.' use for concatenation

echo '<br><br><br>'.
$alphabate['A'].'<br>';
echo $alphabate['a'].'<br>';
echo $alphabate['B'].'<br>';
echo $alphabate['b'].'<br>';
echo $alphabate['C'].'<br>';
echo $alphabate['c'].'<br>';
echo $alphabate['D'].'<br>';
echo $alphabate['d'].'<br>';
echo $alphabate['E'].'<br>';
echo $alphabate['e'].'<br>';

?>

output :

Array ( [A] => APPLE [a] => apple [B] => BALL [b] => ball [C] => CAT [c] => cat [D] => DOLL [d] => doll [E] => ELEPHANT [e] => elephant )


APPLE
apple
BALL
ball
CAT
cat
DOLL
doll
ELEPHANT
elephant

Share Links

Related Posts Plugin for WordPress, Blogger...