On 01 October 2003 11:25, Angelo Zanetti contributed these pearls of wisdom:
Hi
If I have an array and want to remove and element from this
array. correct me if this is the wrong approach:
It's the wrong approach ;)
create a temporary array with 1 element less than the
origional array,
] removing an element from an array
On 01 October 2003 11:25, Angelo Zanetti contributed these pearls of wisdom:
Hi
If I have an array and want to remove and element from this
array. correct me if this is the wrong approach:
It's the wrong approach ;)
create a temporary array with 1 element less
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:[EMAIL PROTECTED]
Sent: miƩrcoles, 01 de octubre de 2003 12:25
Angelo Zanetti [EMAIL PROTECTED] wrote in message
news:[EMAIL PROTECTED]
isnt the unset function not a safe function to use was discontinued,
i
think thats why its not in the manual.
Hi Angelo,
look at the examples on
http://www.php.net/manual/en/function.unset.php
And you know that it is
Daniel Perez Clavero [EMAIL PROTECTED] wrote in
message
news:[EMAIL PROTECTED]
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.
Well this only returns the
Copy/Paste to a php file, and observe how it works. Maybe could be usefull
for u
?
$array1[0]=Red;
$array1[1]=Blue;
$array1[2]=White;
$array1[3]=Black;
$array2[0]=Blue;
$array2[1]=Black;
$array1_result_diff=array_diff($array1, $array2);
echo This is an array with colors not starting with
To: [EMAIL PROTECTED]
Subject: Re: [PHP] removing an element from an array
Daniel Perez Clavero [EMAIL PROTECTED] wrote in
message
news:[EMAIL PROTECTED]
Angelo,
Given array1 extract array2 from there, and put it into $array_result.
$array2[0]=Value to extract;
$array_result = array_diff
7 matches
Mail list logo