Created
July 3, 2016 09:32
-
-
Save lizettepreiss/2391a614f530a9ab8779aa49421ef592 to your computer and use it in GitHub Desktop.
PHP Associative Arrays
This file contains hidden or 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
$age = array("Peter"=>"35", "Ben"=>"37", "Joe"=>"43"); | |
//or | |
$age['Peter'] = "35"; | |
$age['Ben'] = "37"; | |
$age['Joe'] = "43"; | |
echo "Peter is " . $age['Peter'] . " years old."; | |
foreach($age as $x => $x_value) { | |
echo "Key=" . $x . ", Value=" . $x_value; | |
echo "<br>"; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment