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()? Quote Link to comment 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? Quote Link to comment Share on other sites More sharing options...
mapleleaf Posted July 24, 2009 Author Share Posted July 24, 2009 they represent days Quote Link to comment 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". Quote Link to comment 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. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.