note 12741 deleted from function.array-push by jimw
| From: | jimw@php.net | Date: | Fri, 21 Dec 2001 00:42:04 +0000 |
| Subject: | note 12741 deleted from function.array-push by jimw | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-23675@lists.php.net to get a copy of this message | ||
In my experience using array_push does not work with multidimensional arrays
$arrayname= array();
array_push ($array["keyname"], $data);
array_push($array[1], $data);
array_push (($array["keyname"]), $data);
First argument to array_push() needs to be an array
array_push ({$array["keyname"]}, $data);
parse error, expecting `')''
array_push ("$array[keyname]", $data);
Only variables can be passed by reference
I've tried other syntax too, results in one of the above errors. Guess I'm going to have
create a variable variable and then make it an array of data, then make a list of variable variables
and make it another array, pass both arrays to a function and make a loop or 3 to parse it. Any
recommendations beyond the above? Need to assign multiple values while parsing the reply to a
database into an array, grouped by one of the columns of the array.