I can’t believe PHP doesn’t have a built-in function for this…! Code snippet for removing a single index from an array (non-associative).
1 |
I can’t believe PHP doesn’t have a built-in function for this…! Code snippet for removing a single index from an array (non-associative).
1 |
My way…
array_values(array_diff($arr,array($value)));
See http://www.bin-co.com/php/scripts/array_remove.php
There is code for deleting an element from a list and from an associative array.