MemphiS Posted May 31, 2007 Share Posted May 31, 2007 What i wish to do is place numbers into an array and keep the values in there and add new numbers to the array. $array = array("1-a","2-b"); can this be done? Thanks for any posts Link to comment https://forums.phpfreaks.com/topic/53720-arrays/ Share on other sites More sharing options...
chigley Posted May 31, 2007 Share Posted May 31, 2007 To add a new value to an array, use something like this: <?php $array = array("value1"); /* Array currently looks like this: *\ Array ( [0] => value1 ) \* */ $array[] = "value2"; // "value2" is added as the next value onto the array /* Array now looks like this: *\ Array ( [0] => value1 [1] => value2 ) \* */ // And so on... ?> [] can be added on the end of an array to add a new value to the end, basically. Link to comment https://forums.phpfreaks.com/topic/53720-arrays/#findComment-265468 Share on other sites More sharing options...
MemphiS Posted May 31, 2007 Author Share Posted May 31, 2007 Thanks chigley =) very helpful exactly what i was looking for Link to comment https://forums.phpfreaks.com/topic/53720-arrays/#findComment-265474 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.