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
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: mark at togglemedia dot com
New email:
PHP Version: OS:

 

 [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

Pull Requests

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: Sat Oct 12 16:01:26 2024 UTC