note 65055 deleted from function.current by bjori

From: Date: Mon, 24 Apr 2006 15:11:51 +0000
Subject: note 65055 deleted from function.current by bjori
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-109449@lists.php.net to get a copy of this message
Note Submitter: jazepstein at greenash dot net dot au Reason: useless ---- 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.

« previous php.notes (#109449) next »