Created
October 2, 2018 05:21
-
-
Save MubinSayed/0baf92c31705274cecd2a87a0b1e05e9 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$colors = array("0"=>"Red","1"=>"Green","2"=>"Blue"); | |
echo "0th element of array is " . $colors["0"]; | |
echo "<br>"; | |
//looping | |
foreach ($colors as $key=>$value){ | |
echo "Key=".$key." value=".$value; | |
echo "<br>"; | |
} | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$foo = array( | |
1 => "Value1", | |
2 => "Value2", | |
10 => "Value10" | |
); | |
while($bar = each($foo)){ | |
echo $bar[0] . " => " . $bar[1]; | |
} | |
?> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment