|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #18014 Pointers idea in OOP if PHP not consitent
Submitted: 2002-06-27 06:06 UTC Modified: 2002-06-27 06:18 UTC
From: davidktw at singnet dot com dot sg Assigned:
Status: Not a bug Package: Class/Object related
PHP Version: 4.2.1 OS: Windows 2000 Pro
Private report: No CVE-ID: None
View Add Comment Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
You can add a comment by following this link or if you reported this bug, you can edit this bug over here.
Block user comment
Status: Assign to:
Bug Type:
From: davidktw at singnet dot com dot sg
New email:
PHP Version: OS:


 [2002-06-27 06:06 UTC] davidktw at singnet dot com dot 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)
	$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 ?


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2002-06-27 06:18 UTC]
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

Thank you for your interest in PHP.

PHP Copyright © 2001-2023 The PHP Group
All rights reserved.
Last updated: Fri Dec 01 03:01:29 2023 UTC