note 115824 added to spldoublylinkedlist.push

From: Date: Tue, 30 Sep 2014 14:19:01 +0000
Subject: note 115824 added to spldoublylinkedlist.push
Groups: php.notes 
Request: Send a blank email to php-notes+get-200548@lists.php.net to get a copy of this message
Be careful SplStack mode is LIFO (Last In First Out) not FIFO (First in First Out) <?php // Array (FIFO) $stack = array(); array_push($stack,"orange"); array_push($stack,"banana"); array_push($stack,"apple"); array_push($stack,"raspberry"); var_dump($stack); ?> // result array (size=4) 0 => string 'orange' (length=6) 1 => string 'banana' (length=6) 2 => string 'apple' (length=5) 3 => string 'raspberry' (length=9) <?php // SplStack (LIFO) $stack = new SplStack(); $stack ->push('orange'); $stack ->push('banana'); $stack ->push('apple'); $stack->push('raspberry'); $stack->rewind(); while($stack->valid()){ var_dump($stack->current()); $stack->next(); } ?> //result string 'raspberry' (length=9) string 'apple' (length=5) string 'banana' (length=6) string 'orange' (length=6) ---- Server IP: 72.52.91.14 Probable Submitter: 90.3.17.119 ---- Manual Page -- http://php.net/manual/en/spldoublylinkedlist.push.php Edit -- https://master.php.net/note/edit/115824 Del: integrated -- https://master.php.net/note/delete/115824/integrated Del: useless -- https://master.php.net/note/delete/115824/useless Del: bad code -- https://master.php.net/note/delete/115824/bad+code Del: spam -- https://master.php.net/note/delete/115824/spam Del: non-english -- https://master.php.net/note/delete/115824/non-english Del: in docs -- https://master.php.net/note/delete/115824/in+docs Del: other reasons-- https://master.php.net/note/delete/115824 Reject -- https://master.php.net/note/reject/115824 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#200548) next »