User Tools

Site Tools


phpsqlet:associative_arrays

This is an old revision of the document!


ArraysBooleans

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.1460558341.txt.gz · Last modified: 2016/04/13 16:39 by leo