phpsqlet:associative_arrays
associative Arrays
→ an object-indexed collection of objects
→ couples clé/valeur
compare
- array :
- si l'ordre est important
- associative array
- si avoir un “reference label” est important
$assoc = array(); // empty associated/regular array $assoc = array("first_name" => "Maurice", "last_name" => "Dupont"); echo $assoc["first_name"] . " " . $assoc["last_name"]; // "Maurice Dupont" $assoc["first_name"] = "José"; echo $assoc["first_name"] . " " . $assoc["last_name"]; // "José Dupont" $numbers = array(2,4,6); // identique à $numbers = array(0 => 2, 1 => 4, 2 =>6);
phpsqlet/associative_arrays.txt · Last modified: 2016/04/13 16:49 by leo