how to use array_push when pushing both key and value in PHP -
i have empty array. able push values using
array_push($list, item[0]);
but how push both key , value.
array_push($list[$key], $item[0])
this not work.
$list['key']=$item[0];
should work.
note: if use array_push() add 1 element array it's better use $array[] = because in way there no overhead of calling function.
Comments
Post a Comment