note 26744 modified in function.array-splice by vrana

From: Date: Tue, 17 Aug 2004 14:49:54 +0000
Subject: note 26744 modified in function.array-splice by vrana
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-79830@lists.php.net to get a copy of this message
It is possible to use a string instead of offset, eg if you want to deletre the entry $myArray['entry'] then you can simply do it like this: <?php array_splice($myArray, 'entry', 1); ?> Note that you can use unset($myArray['entry']) as well but then, it doesn't enable you to remove more than one entry and it doesn't replace anything in the array, if that's what you intend to do. --was-- It is possible to use a string instead of offset, eg if you want to deletre the entry $myArray['entry'] then you can simply do it like this: array_splice($myArray, 'entry', 1); Note that you can use unset($myArray['entry']) as well but then, it doesn't enable you to remove more than one entry and it doesn't replace anything in the array, if that's what you intend to do. http://php.net/manual/en/function.array-splice.php

« previous php.notes (#79830) next »