Doc #61157 [Opn->Csd]: Documentation says array_slice() resets array pointer, but it doesn't.

From: Date: Wed, 18 Jul 2012 11:39:22 +0000
Subject: Doc #61157 [Opn->Csd]: Documentation says array_slice() resets array pointer, but it doesn't.
References: 1  Groups: php.doc.bugs 
Request: Send a blank email to doc-bugs+get-8568@lists.php.net to get a copy of this message
Edit report at https://bugs.php.net/bug.php?id=61157&edit=1 ID: 61157 Updated by: nikic@php.net Reported by: ben at bravenet dot com Summary: Documentation says array_slice() resets array pointer, but it doesn't. -Status: Open +Status: Closed Type: Documentation Problem Package: Documentation problem Operating System: n/a PHP Version: Irrelevant -Assigned To: +Assigned To: nikic Block user comment: N Private report: N New Comment: This bug has been fixed in the documentation's XML sources. Since the online and downloadable versions of the documentation need some time to get updated, we would like to ask you to be a bit patient. Thank you for the report, and for helping us make our documentation better. Previous Comments: ------------------------------------------------------------------------ [2012-02-21 19:47:00] ben at bravenet dot com Description: ------------ In the documentation at http://php.net/array_slice it states: "Note: This function will reset() the array pointer of the input array after use." However, a quick test shows that this is not the case. Test script: --------------- $array = array(1, 2, 3); next($array); //move pointer to second position (key 1) var_dump(current($array)); //output int(2) $last = array_slice($array, -1); //get last element var_dump(current($array)); //output int(2) pointer not reset! ------------------------------------------------------------------------ -- Edit this bug report at https://bugs.php.net/bug.php?id=61157&edit=1

« previous php.doc.bugs (#8568) next »