note 65055 added to function.current

From: Date: Mon, 24 Apr 2006 14:44:06 +0000
Subject: note 65055 added to function.current
Groups: php.notes 
Request: Send a blank email to php-notes+get-109446@lists.php.net to get a copy of this message
I have found the array_set_current() function described below to be extremely unreliable - on some machines it works, on others it doesn't (PHP version doesn't seem to make a difference, from what I've seen). The problem I've encountered is that on some servers, when you pass an array by reference to a function, and you modify the array's internal pointer using prev() and next(), the new internal pointer IS NOT PASSED BACK along with other changes that you make to the array! I spent many hours debugging this problem, and this is the clear conclusion that I have reached. My advice is to take the code within this function, and to use it directly wherever you need it. This may cause some duplicate code in your script, but hopefully you don't need to use it in too many places anyway. If you do it like this, instead of by calling the function and passing the array by reference, you can rest assured that the array's internal pointer will get modified. ---- Server IP: 66.163.161.117 Probable Submitter: 203.217.92.121 ---- X-Spam-Status: No, hits=3.1 required=5.0 tests=DATE_MISSING,FROM_NO_LOWER autolearn=no version=2.64 ---- Manual Page -- http://www.php.net/manual/en/function.current.php Edit -- http://master.php.net/note/edit/65055 Del: integrated -- http://master.php.net/note/delete/65055/integrated Del: useless -- http://master.php.net/note/delete/65055/useless Del: bad code -- http://master.php.net/note/delete/65055/bad+code Del: spam -- http://master.php.net/note/delete/65055/spam Del: non-english -- http://master.php.net/note/delete/65055/non-english Del: in docs -- http://master.php.net/note/delete/65055/in+docs Del: other reasons-- http://master.php.net/note/delete/65055 Reject -- http://master.php.net/note/reject/65055 Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#109446) next »