note 104192 added to spldoublylinkedlist.offsetunset

From: Date: Tue, 31 May 2011 12:40:20 +0000
Subject: note 104192 added to spldoublylinkedlist.offsetunset
Groups: php.notes 
Request: Send a blank email to php-notes+get-180116@lists.php.net to get a copy of this message
When unsetting an offset, the element will be removed from the double linked list. So the following code: <?php $obj = new SplDoublyLinkedList(); $obj->push(4); $obj->push(5); $obj->push(6); $obj->offsetUnset(1); echo "Our Linked List:"; print_r($obj); ?> Will output: Our Linked List:SplDoublyLinkedList Object ( [flags:SplDoublyLinkedList:private] => 0 [dllist:SplDoublyLinkedList:private] => Array ( [0] => 4 [1] => 5 [2] => 6 ) ) Our New Linked List:SplDoublyLinkedList Object ( [flags:SplDoublyLinkedList:private] => 0 [dllist:SplDoublyLinkedList:private] => Array ( [0] => 4 [1] => 6 ) Notice that the element with the index 2 has now the index 1. The original element with index 1 did not only had it's value unset but was also removed from the list. ---- Server IP: 87.124.126.127 Probable Submitter: 87.194.4.54 (proxied: 87.194.4.54) ---- Manual Page -- http://www.php.net/manual/en/spldoublylinkedlist.offsetunset.php Edit -- https://master.php.net/note/edit/104192 Del: integrated -- https://master.php.net/note/delete/104192/integrated Del: useless -- https://master.php.net/note/delete/104192/useless Del: bad code -- https://master.php.net/note/delete/104192/bad+code Del: spam -- https://master.php.net/note/delete/104192/spam Del: non-english -- https://master.php.net/note/delete/104192/non-english Del: in docs -- https://master.php.net/note/delete/104192/in+docs Del: other reasons-- https://master.php.net/note/delete/104192 Reject -- https://master.php.net/note/reject/104192 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#180116) next »