Jump to content

how do I strip out key values names?


stinkbug

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.