Re: add element to an array
| From: | Matthias Nothhaft | Date: | Mon, 29 Sep 2003 09:07:40 +0000 |
| Subject: | Re: add element to an array | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-164208@lists.php.net to get a copy of this message | ||
Hi Angelo Zanetti, you wrote:
Hi, I want to add a new element to an array in php, is the following way the correct way? assuming that $chk is an array and $ID contains a value. $j = count($chk); $j++; $chk[$j] = $ID;Keep it simple, this is enough: $chk[] = $ID; This appends a new element at the end of your array. Regards, Matthias