View Full Version : Remove Member from Array
10-14-2003, 06:07 PM
Is there a built in function that will remove a member from an array or should I build my own?
10-14-2003, 07:48 PM
There is. It's called unset().
$foo = array('apple', 'pear', 'mango');
Watch out if you intend to iterate over the modified array, because unset() does not cause it to re-index itself. Use $foo = array_values($foo) or a foreach-loop instead. With associative arrays, you don't have this problem.
Powered by vBulletin® Version 4.2.2 Copyright © 2016 vBulletin Solutions, Inc. All rights reserved.