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