note 40327 added to function.next

From: Date: Sun, 29 Feb 2004 02:15:23 +0000
Subject: note 40327 added to function.next
Groups: php.notes 
Request: Send a blank email to php-notes+get-65975@lists.php.net to get a copy of this message
my code is as follows on PHP 4.2.2: class Messaging { // be sure to get the messaging system folder from config.php // it will be defined as MESSAGINGFOLDER // in this script's present state, MESSAGINGFOLDER will be defined here. var $links; var $titles; /** * @name Messaging() * @description * This is the default constructor for a Messaging object. * Presently, nothing is required, and nothing is stored here. */ function Messaging() { $this->$links = array( "get_new" => "./get_messages.php", "write" => "./write_message.php", "display" => "./get_message.php", "folders" => "./manage_folders.php", "edit_signature" => "./edit_signature.php" ); $this->$titles = array( "get_new" => "Get New Messages", "write" => "Write a Message", "display" => "Display Selected Message", "folders" => "Manage Your Folders", "edit_signature" => "Edit Your Signature" ); } /** * @name get_link() * @param $id * @description * Generates a link for the messaging system, based on Id number or name */ function get_link() { return ("\n<a href=\"" . current($this->$links) . "\">" . current($this->$titles) . "</a>"); } function get_numLinks() { return count($this->$links); } function is_set() { if (isset($this->$links)) { return ("TRUE! :: " . $this->get_numLinks()); } else { return "FALSE."; } } function nextLink() { next($this->$links); } } $msg = new Messaging(); echo $msg->is_set(); $i = 0; while ($i < count($msg->$links)) { echo $msg->get_link($i); $msg->nextLink(); $i++; } ?> I cannot figure out why the next(); command for arrays requires an array, but advances every array in that class. Is this a 4.2.2 bug? ---- Manual Page -- http://www.php.net/manual/en/function.next.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+40327 Delete -- http://master.php.net/manage/user-notes.php?action=delete+40327&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+40327&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#65975) next »