Jump to content

Offsets in arrays


lemmin

Recommended Posts

The functions array_slice() array_splice() (maybe another few, but I don' think so) are the only array functions that use an offset instead of a key. Normally this wouldn't be a problem, but, as far as I can tell, there are no php functions to aid in finding the offset of a key, or even a value. Of course, you can use different methods of getting the offset of what you are looking for, depending on what you are trying to do, but I'm wondering, is there any way to simplify this? Is it possible to, for example, use array_splice() on one key that you know the name of, without looping through the array looking for that key? These two functions just seem so akward compared to all the other ones.

 

Thanks for any info.

Link to comment
https://forums.phpfreaks.com/topic/67377-offsets-in-arrays/
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.