I don't know how about you, but I'm not very fond of the way arrays are constructed in PHP. I have this feeling that I use array
keyword way too often and that array($k => $v)
or e.g. array($k1=>array($k2=>$v))
are way too long given usefulness of maps.
(Moreover, recently I've learned JS way of doing it and now I really am jealous)
The best I could come up with to remedy this is:
function a() { // array
return func_get_args();
}
and
function h() { // hash
$array=array();
for($i=0; $i<func_num_args()-1; $i+=2) {
$array[func_get_arg($i)]=func_get_arg($i+1);
}
return $array;
}
...but they don't permit using =>
operator.
Any other ideas?