Re: Add to array problem
| From: | Petar Nedyalkov | Date: | Mon, 16 May 2005 15:54:24 +0000 |
| Subject: | Re: Add to array problem | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-215306@lists.php.net to get a copy of this message | ||
On Monday 16 May 2005 17:26, mayo wrote:
> I'm having a little problem adding to an array. Each time I add to an
> array it wipes what was previously added. I'm using array_push().
>
> $items=array();
> $items=array_push($items, $_POST["whatever"]);
Don't assign the result of the array_push() function to $items. That's the
reason for flushing the array.
try:
if (array_push($items, $_POST['whatever'])) {
// something
}
>
> I'm missing something easy.
>
> thx
--
Cyberly yours,
Petar Nedyalkov
Devoted Orbitel Fan :-)
PGP ID: 7AE45436
PGP Public Key: http://bu.orbitel.bg/pgp/bu.asc
PGP Fingerprint: 7923 8D52 B145 02E8 6F63 8BDA 2D3F 7C0B 7AE4 5436
Attachment: [application/pgp-signature]
Attachment: [application/pgp-signature]