mapleleaf Posted July 24, 2009 Share Posted July 24, 2009 I need to add to an array So I start with this $inputs = array( 3 => 'dsdsd'); and want to add: 7 => 'ffdfd', 22 => 'more blah' Can I use array_push()? Link to comment https://forums.phpfreaks.com/topic/167331-solved-arrays-and-array-push/ Share on other sites More sharing options...
vineld Posted July 24, 2009 Share Posted July 24, 2009 Why do you only want specific index values in the first place? Link to comment https://forums.phpfreaks.com/topic/167331-solved-arrays-and-array-push/#findComment-882334 Share on other sites More sharing options...
mapleleaf Posted July 24, 2009 Author Share Posted July 24, 2009 they represent days Link to comment https://forums.phpfreaks.com/topic/167331-solved-arrays-and-array-push/#findComment-882338 Share on other sites More sharing options...
vineld Posted July 24, 2009 Share Posted July 24, 2009 Alright. Depending on what you are trying to accomplish I might have chosen a different approach. Array_push will not work that way. You need to assign them directly, e.g. $myArray[3] = "blabla". Link to comment https://forums.phpfreaks.com/topic/167331-solved-arrays-and-array-push/#findComment-882349 Share on other sites More sharing options...
mapleleaf Posted July 24, 2009 Author Share Posted July 24, 2009 vineld thank you. The obvious needs to be looked at first. I am running out of brain cells here. Link to comment https://forums.phpfreaks.com/topic/167331-solved-arrays-and-array-push/#findComment-882351 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.