[PHP] Delete element from an array (PHP3)

2001-10-05 Thread John Steele
In PHP4, unset($myarray['3']['someindex'}) removes this element (inside a class function passed $myarray). I need to do the same for PHP3 - what is the simplest way to accomplish this? I guess I'm looking for a function that supports PHP3 or PHP4, say: function unset_arr ($array) { if (

Re: [PHP] delete element from an array

2001-09-19 Thread Philip Olson
Here's an example using unset() and array_splice(), notice the subtle difference : a [2] => c $bar = array('a','b','c'); $piece = array_splice ($bar, 1 ,1); print_r($piece); // [0] => b print_r($bar);// [0] => a [1] => c ?> Regards, Philip Olson On Thu, 20 S

[PHP] delete element from an array

2001-09-19 Thread Miroslav Figlar
Hi, what is the best way to delete element from an array? Suppose i have an array called $numbers: $numbers = array(a => 10, b => 20, c => 30, d => 40); I want to delete the third element from that array. Thank you Miro Figlar -- PHP General Mailing List (http://www.php.net/) To unsubscribe