Jump to content

Delete element from array by value


tibberous

Recommended Posts

You can use unset() to remove array elements. For indexed arrays PHP does not reorder the index after an unset(), so you can end up with non-sequential indices.

 

unset($arr[1]);

 

Although it's possible I'm wrong, but atleast it gives you a search term for google :)

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.