note 125086 added to function.iterator-count

From: Date: Fri, 05 Jun 2020 14:33:17 +0000
Subject: note 125086 added to function.iterator-count
Groups: php.notes 
Request: Send a blank email to php-notes+get-214728@lists.php.net to get a copy of this message
After using this function, the traversable's pointer will point at the end. Examples 2 and 3 highlight this using code. This means that when you call iterator_count($foo)... - Before a foreach-loop on $foo, the loop will not execute because it's already at the end. Calling $foo->rewind() will reset the traversable to the beginning. - Inside a foreach-loop on $foo, the loop will complete the current iteration and not repeat. Something like $foo->seek($i) can be used to reset the pointer, where $i contains the pointer's value prior to counting. ---- Server IP: 45.112.84.4 Probable Submitter: 103.51.166.36 (proxied: 2601:283:8201:953c:cb7:ee9e:238:3fdc) ---- Manual Page -- http://php.net/manual/en/function.iterator-count.php Edit -- https://master.php.net/note/edit/125086 Del: integrated -- https://master.php.net/note/delete/125086/integrated Del: useless -- https://master.php.net/note/delete/125086/useless Del: bad code -- https://master.php.net/note/delete/125086/bad+code Del: spam -- https://master.php.net/note/delete/125086/spam Del: non-english -- https://master.php.net/note/delete/125086/non-english Del: in docs -- https://master.php.net/note/delete/125086/in+docs Del: other reasons-- https://master.php.net/note/delete/125086 Reject -- https://master.php.net/note/reject/125086 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#214728) next »