Bug #18014 Updated: Pointers idea in OOP if PHP not consitent
| From: | sander@php.net | Date: | Thu, 27 Jun 2002 10:18:32 +0000 |
| Subject: | Bug #18014 Updated: Pointers idea in OOP if PHP not consitent | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-12223@lists.php.net to get a copy of this message | ||
ID: 18014
Updated by: sander@php.net
Reported By: davidktw@singnet.com.sg
-Status: Open
+Status: Bogus
Bug Type: Class/Object related
Operating System: Windows 2000 Pro
PHP Version: 4.2.1
New Comment:
Sorry, but the bug system is not the appropriate forum for asking
support questions. Your problem does not imply a bug in PHP itself.
For a list of more appropriate places to ask for help using PHP,
please visit http://www.php.net/support.php
Thank you for your interest in PHP.
Previous Comments:
------------------------------------------------------------------------
[2002-06-27 06:06:51] davidktw@singnet.com.sg
class Node
{
var $name;
var $next;
function Node($name)
{
$this->name = $name;
$this->next = NULL;
}
function getNext()
{
return $this->next;
}
function setNext($next)
{
$this->next = $next;
}
}
$head = new Node("david");
$curr = $head;
$curr->setNext(new Node("peter"));
$curr = $curr->getNext();
$curr->setNext(new Node("john"));
$curr = $head;
while ($curr)
{
print("<p>".$curr->name."</p>");
$curr = $curr->getNext();
}
The problem with the code above is.. only "david" is printed.. why
isn't the rest of the Nodes printed ?
I have checked the linkage
If seems like $curr->next is NULL instead of the next Node in the
linkedlist... What have I did wrongly ?
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=18014&edit=1