note 40327 rejected from function.next by irchtml
| From: | irchtml@php.net | Date: | Sun, 29 Feb 2004 02:15:51 +0000 |
| Subject: | note 40327 rejected from function.next by irchtml | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-65976@lists.php.net to get a copy of this message | ||
Note Submitter: e.entropy@juno.com
----
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?