RE: [PHP] Add to array problem
| From: | Mark Rees | Date: | Mon, 16 May 2005 15:42:45 +0000 |
| Subject: | RE: [PHP] Add to array problem | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-215304@lists.php.net to get a copy of this message | ||
-----Original Message-----
From: mayo [mailto:mayo@nycinteractive.com]
Sent: 16 May 2005 15:26
To: php
Subject: [PHP] Add to array problem
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();
Looking at the PHP docs (always a good place to start), it appears that
you do not need to assign the result of this function to an array,
rather it modifies the array you specify
hence
$items=array_push($items, $_POST["whatever"]);
Should be
array_push($items, $_POST["whatever"]);
I'm missing something easy.
http://uk.php.net/manual/en/function.array-push.php
thx
Gamma Global : Suppliers of HPCompaq, IBM, Acer, EPI, APC, Cyclades, D-Link, Cisco, Sun
Microsystems, 3Com
GAMMA GLOBAL (UK) LTD IS A RECOGNISED 'INVESTOR IN PEOPLE' AND AN 'ISO 9001
2000' REGISTERED COMPANY
**********************************************************************
CONFIDENTIALITY NOTICE:
This Email is confidential and may also be privileged. If you are not the
intended recipient, please notify the sender IMMEDIATELY; you should not
copy the email or use it for any purpose or disclose its contents to any
other person.
GENERAL STATEMENT:
Any statements made, or intentions expressed in this communication may not
necessarily reflect the view of Gamma Global (UK) Ltd. Be advised that no content
herein may be held binding upon Gamma Global (UK) Ltd or any associated company
unless confirmed by the issuance of a formal contractual document or
Purchase Order, subject to our Terms and Conditions available from http://www.gammaglobal.com
E&OE
**********************************************************************
**********************************************************************