<-- 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 element to an array is by using array_push syntax is array_push($array,$vartoadd); there is also a keyed method but I am not 100% familiar with it and still getting the hang of it. Chris -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php