Re: [PHP] add element to an array

2003-09-29 Thread Chris Sherwood
<-- snip --> > 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; <-- snip --> Yes that is one method of doing it. another method of adding an elemen

Re: [PHP] add element to an array

2003-09-29 Thread Matthias Nothhaft
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