Browse - Programming Tips - How do I delete an element from a PHP array?

Date: 2007nov19
Language: php

Q.  How do I delete an element from a PHP array?

A.  You can unset($a[$element]) but that leaves a hole so the only way is
to copy the array to a new one without the unwanted element.

I think this is an unfortunate limitation for a high level language.
Even C++'s vector can erase() elements.

The only exceptions are:

array_shift() Remove the first array element array_pop() Remove the last array element