have to be numbers! Appending with $arr[] Similar to PERL <?php $arr = array(); $arr[32] = 23; // following appends to [33] $arr[] = 24 $arr = array(“foo”=>1, “bar”=>2); print $array[“foo”]; print $array[“bar”]; ?> http://php.net/manual/en/language.types.array.php
Similar to Java’s for(int a : arr) $languages = array( ‘best’ => ‘php’, ‘worst’ => ‘brainf*ck’, ‘easy’ => ‘php’ ); // Iterate as key-value pair foreach ($languages as $adj => $lang) { print “The $adj language is $lang”; } // Iterate over values foreach ($languages as $lang) { print “One language is $lang”; }
small files called “Cookies” Set with setcookie() Access with $_COOKIE Happens in HTTP header, before any HTML setcookie ($name, $value, $expire) $new_value = $_COOKIE[$name]; http://php.net/manual/en/function.setcookie.php