php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #37 unexpected reset() behaviour with multi-dimensionsal arrays
Submitted: 1998-02-05 08:42 UTC Modified: 1998-02-05 15:42 UTC
From: mark at togglemedia dot com Assigned:
Status: Closed Package: Feature/Change Request
PHP Version: 3.0b4 OS: WIN32
Private report: No CVE-ID: None
 [1998-02-05 08:42 UTC] mark at togglemedia dot com
With a multi-dimnesional array, $array, the reset() function does not seem to reset the array pointers for all of the dimensions of the array.

For example, with an array such as...

$session["tab"][0]["test1"]=abc;
$session["tab"][0]["test2"]=abc2;
$session["peter"][1]["test1"]=abc;
$session["tab"][1]["test1"]=abc;
$session["tab"][2]=aaaargh;
$session["name"]="mark";

I currently need to do the following to reset it:

reset($session);
reset($session["tab"]);
reset($session["tab"][0]);
...

rather than simply 

reset($session);
or
reset($session[]);

-- Mark

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [1998-02-05 15:42 UTC] andi
This is the way reset() behaves. It's probably going to stay this way too.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Feb 22 05:01:28 2024 UTC