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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
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

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: Sat Apr 20 22:01:27 2024 UTC