Jump to content

Recommended Posts

 

I'm a php newbie so this might be a stupid question, but.....

 

I'm dealing with an array that has key names that are not useful to me.  The key names are based on the values they point to so they are always changing.  I'm unable to change the function that creates the array.

 

Ideally I'd like to refer to the array variables by index number (i.e. $stupidArray[0]).  My solution was to implode the array into a string and then turn that string into a new array.  It seems to work.

 

But is there a cleaner way of doing that?  I see that there are functions to do all sorts of things to keys, but I didn't see a method for just clearing out the key names and replacing them with index numbers.  I suppose there's probably some super simple way of doing this but I'm still in my earlier php/programming stage so I'm clueless half the time.

 

Thanks!

 

 

 

Link to comment
https://forums.phpfreaks.com/topic/97195-how-do-i-strip-out-key-values-names/
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.