note 87439 rejected from book.array by danbrown

From: Date: Fri, 05 Dec 2008 05:30:32 +0000
Subject: note 87439 rejected from book.array by danbrown
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-147666@lists.php.net to get a copy of this message
Note Submitter: darkain at darkain dot com ---- Re: alan dot lake at lakeinfoworks dot com There is no need to write a custom function to remove an element from an array based off of its key. I've seen people do this far too many times, and there is absolutely no reason to do so. <?php unset($arr['key']); ?> That will do the exact same thing. I've also seen people try to use isset() on a variable or array key before running unset(), but there is absolutely no need for this either. unset() implicityly checks for the existance of the variable/key beforehand, and does nothing if it does not exist (no errors/warnings/notices at all)

« previous php.notes (#147666) next »