lang/php/ ArrayCheatsheet
array( "key1" => "value1" , "key2" => "value2 ); # note not a:b like in Python or Javascript
array_key_exists(string|int $key, array $array): bool # does $array contain $key
array_push(array &$array, mixed ...$values): int # push ...$values onto $array
$value - array_pop($array);
$array = explode("delim",$string);
$string = implode("delim",$array);
The extract()
allows us to import values from an array into the local variable scope:
$d = array("a"=>"hello","b"=>"world");
function f($x) {
extract($x);
echo "$a $b\n";
}
f($d); # prints "hello world"