note 75843 added to function.unset

From: Date: Mon, 18 Jun 2007 17:35:25 +0000
Subject: note 75843 added to function.unset
Groups: php.notes 
Request: Send a blank email to php-notes+get-127545@lists.php.net to get a copy of this message
Regarding the 14-May-2007 note from anonymous: As far as array elements go, unset() is really only useful for removing named keys. For numeric keys, you can use array_splice to "unset" the element. <?php $a = array( 'foo' => array('a', 'b', 'c'), 'bar' => array('d', 'e', 'f') ); print_r($a); array_splice($a['foo'], 1, 1); print_r($a); unset($a['foo']); print_r($a); ?> ---- Server IP: 64.71.164.2 Probable Submitter: 192.138.178.142 ---- Manual Page -- http://www.php.net/manual/en/function.unset.php Edit -- https://master.php.net/note/edit/75843 Del: integrated -- https://master.php.net/note/delete/75843/integrated Del: useless -- https://master.php.net/note/delete/75843/useless Del: bad code -- https://master.php.net/note/delete/75843/bad+code Del: spam -- https://master.php.net/note/delete/75843/spam Del: non-english -- https://master.php.net/note/delete/75843/non-english Del: in docs -- https://master.php.net/note/delete/75843/in+docs Del: other reasons-- https://master.php.net/note/delete/75843 Reject -- https://master.php.net/note/reject/75843 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#127545) next »