note 129041 added to function.next

From: Date: Mon, 13 Nov 2023 09:53:15 +0000
Subject: note 129041 added to function.next
Groups: php.notes 
Request: Send a blank email to php-notes+get-220997@lists.php.net to get a copy of this message
Be attentive! It is possibility to lose the array pointer with next() and prev(); <?php // example $array = array( 'fruit1' => 'apple', 'fruit2' => 'orange', 'fruit3' => 'grape', 'fruit4' => 'apple', 'fruit5' => 'apple'); reset($array); // prepare array $row = current($array); var_dump($row); // 'apple' $row = prev($array); var_dump($row); // false. The array pointer is lossed! $row = next($array); // it is not possible to return to the previous (first/last element)! var_dump($row); // false ?> ---- Server IP: 45.112.84.4 Probable Submitter: 45.91.157.134 (proxied: 212.90.59.36) ---- Manual Page -- https://php.net/manual/en/function.next.php Edit -- https://main.php.net/note/edit/129041 Del: integrated -- https://main.php.net/note/delete/129041/integrated Del: useless -- https://main.php.net/note/delete/129041/useless Del: bad code -- https://main.php.net/note/delete/129041/bad+code Del: spam -- https://main.php.net/note/delete/129041/spam Del: non-english -- https://main.php.net/note/delete/129041/non-english Del: in docs -- https://main.php.net/note/delete/129041/in+docs Del: other reasons-- https://main.php.net/note/delete/129041 Reject -- https://main.php.net/note/reject/129041 Search -- https://main.php.net/manage/user-notes.php

« previous php.notes (#220997) next »