RE: [PHP] removing an element from an array
| From: | Daniel Perez Clavero | Date: | Wed, 01 Oct 2003 10:39:15 +0000 |
| Subject: | RE: [PHP] removing an element from an array | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-164522@lists.php.net to get a copy of this message | ||
Angelo,
Given array1 extract array2 from there, and put it into $array_result.
$array2[0]="Value to extract";
$array_result = array_diff ($array1, $array2);
Should work.
Rgrds.
-----Original Message-----
From: Angelo Zanetti [mailto:binc2@ctech.ac.za]
Sent: miércoles, 01 de octubre de 2003 12:25
To: Php-General@Lists.Php.Net
Subject: [PHP] removing an element from an array
Hi
If I have an array and want to remove and element from this array. correct
me if this is the wrong approach:
create a temporary array with 1 element less than the origional array, get
the position of the element ( is there a function for this?) and then run
through the origional array copying all elements besides the element which
is meant to be removed.
Is there no function to do this? It seems like alot of overhead to do this
process, especially if the array is big. comments?
Angelo
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php