note 87439 added to book.array

From: Date: Fri, 05 Dec 2008 05:28:31 +0000
Subject: note 87439 added to book.array
Groups: php.notes 
Request: Send a blank email to php-notes+get-147664@lists.php.net to get a copy of this message
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) ---- Server IP: 209.41.74.194 Probable Submitter: 131.191.14.252 ---- Manual Page -- http://www.php.net/manual/en/book.array.php Edit -- https://master.php.net/note/edit/87439 Del: integrated -- https://master.php.net/note/delete/87439/integrated Del: useless -- https://master.php.net/note/delete/87439/useless Del: bad code -- https://master.php.net/note/delete/87439/bad+code Del: spam -- https://master.php.net/note/delete/87439/spam Del: non-english -- https://master.php.net/note/delete/87439/non-english Del: in docs -- https://master.php.net/note/delete/87439/in+docs Del: other reasons-- https://master.php.net/note/delete/87439 Reject -- https://master.php.net/note/reject/87439 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#147664) next »