OK I wrote this function to delete a specific value in an array, it
shouldn�t be hard to modify it to do what you need it to do. $num is the
value I want to delete, $cartVals is the array. If you have any questions
feel free to contact me. Cheers!
function cartRem($num) {
global $cartVals;
$cartVals[(array_search($num, $cartVals))] = NULL;
sort($cartVals);
array_shift($cartVals);
cartSave($cartVals);
return "Program #$num has been Removed from your shopping cart";
}
Rick
"I count him braver who overcomes his desires than him who conquers his
enemies; for the hardest victory is over self." - Aristotle
> From: Lars Torben Wilson <[EMAIL PROTECTED]>
> Date: 26 Apr 2002 12:50:03 -0700
> To: Pushkar Pradhan <[EMAIL PROTECTED]>
> Cc: Erik Price <[EMAIL PROTECTED]>, Liam Gibbs <[EMAIL PROTECTED]>,
> [EMAIL PROTECTED]
> Subject: Re: [PHP] Array function to delete
>
> On Thu, 2002-04-25 at 12:32, Pushkar Pradhan wrote:
>> That's neat but I just read the docs. it says unset() won't work inside a
>> function, even if you pass by reference!
>
> No, that is not at all what it says.
>
>> Anyways as far as you don't use functions to do the delete it will work
>> fine.
>>> On Thursday, April 25, 2002, at 03:22 PM, Liam Gibbs wrote:
>>>
>>>> I've been checking the PHP documentation, but can't
>>>> find a function that will delete a member of an array,
>>>> like such:
>>>>
>>>> $a = array(1, 2, 3, 4, 5);
>>>>
>>>> Use the function, say array_delete($a, 3); and that
>>>> will delete the third member in the array (which would
>>>> be 4 above), so that the array would contain 1, 2, 3,
>>>> 5.
>>>>
>>>> Is there such a function?
>>>
>>> It's a secret. Sshh!
>>>
>>> unset($a[0]); // removes the first element
>>>
>>>
>>>
>>> Erik
>>>
>>>
>>>
>>>
>>> ----
>>>
>>> Erik Price
>>> Web Developer Temp
>>> Media Lab, H.H. Brown
>>> [EMAIL PROTECTED]
>>>
>>>
>>> --
>>> PHP General Mailing List (http://www.php.net/)
>>> To unsubscribe, visit: http://www.php.net/unsub.php
>>>
>>
>> -Pushkar S. Pradhan
>>
>>
>> --
>> PHP General Mailing List (http://www.php.net/)
>> To unsubscribe, visit: http://www.php.net/unsub.php
>>
> --
> Torben Wilson <[EMAIL PROTECTED]>
> http://www.thebuttlesschaps.com
> http://www.hybrid17.com
> http://www.inflatableeye.com
> +1.604.709.0506
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php