JREAM Posted December 26, 2009 Share Posted December 26, 2009 You can tell this causes an error: $set = array(1, 2, 3, 4); $set = array(5, 6, 7, ; So I could do $set = array(1, 2, 3, 4); $set2 = array(5, 6, 7, ; $all = array_merge($set, $set2); And also $set = array(1, 2, 3, 4); $set[] = 5; $set[] = 6; // etc. But is there a way to do like.. $set = array(1, 2, 3, 4); $set .= array(5, 6, 7, ; // Notice the period Link to comment https://forums.phpfreaks.com/topic/186383-newbie-add-to-array/ Share on other sites More sharing options...
.josh Posted December 26, 2009 Share Posted December 26, 2009 that's what the array_merge does. Is there a particular reason why you can't do that (or the other things you mentioned)? Link to comment https://forums.phpfreaks.com/topic/186383-newbie-add-to-array/#findComment-984255 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.