Delete element from an array (PHP3)
| From: | John Steele | Date: | Fri, 05 Oct 2001 12:01:53 +0000 |
| Subject: | Delete element from an array (PHP3) | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-70135@lists.php.net to get a copy of this message | ||
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 (phpversion() < 4)
// get rid of the array element here...
else
unset ($array);
}
I'm assuming that I will have to do some shuffling of the array, and possibly return a new
array with that element missing?
Thanks for any help on this,
John
--
/* SteeleSoft Consulting John Steele - Systems Analyst/Programmer
* We also walk dogs... PHP/MySQL/Linux/Hosting - jsteele@writeme.com
* http://www.steelesoftconsulting.com
*/