Jump to content

Archived

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

knowram

Arrays

Recommended Posts

Ok there must be some way to just take a given variable out of an array no mater where in that array the variable is. I have searched php.net for some time and can only find functions to split the array in two or take variables of the beginning or end of the array.

thanks for the help

Share this post


Link to post
Share on other sites
If you know the key for that slice of the array just do unset($array['key'])

If you don't know the key you could get it through array_search.

[code]
$key=array_search($var,$array);
unset($array[$key]);
[/code]

Share this post


Link to post
Share on other sites

×

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.