|  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #15232 Need a possibility to compare two references
Submitted: 2002-01-26 06:18 UTC Modified: 2013-07-12 12:41 UTC
Avg. Score:4.4 ± 0.7
Reproduced:5 of 5 (100.0%)
Same Version:0 (0.0%)
Same OS:4 (80.0%)
From: flying at dom dot natm dot ru Assigned:
Status: No Feedback Package: *General Issues
PHP Version: 4.0.6 OS: All
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: flying at dom dot natm dot ru
New email:
PHP Version: OS:


 [2002-01-26 06:18 UTC] flying at dom dot natm dot ru
 PHP have no possiblity to find, if two references points to the same actual variable, but sometimes it is necesary.

Short example:

$a = 5;
$b = 5;
$a_ref1 = &$a;
$a_ref2 = &$a;
$b_ref = &$b;

 PHP needs a function (or operator) which will return TRUE, when comparing $a_ref1 and $a_ref2, but FALSE, if comparing $a_ref1 and $b_ref.


Add a Patch

Pull Requests

Add a Pull Request


AllCommentsChangesGit/SVN commitsRelated reports
 [2011-08-23 14:19 UTC]
For scalar values, this is impossible. And you probably don't want this either, 
because $a and $b might actually point to the same value (e.g. due to compiler 

For objects you could use the equality operator (===). For example:
$a = new mynumber(5);
$b = new mynumber(5);

echo $a === $b;
 [2013-07-12 12:41 UTC]
-Status: Open +Status: No Feedback -Package: Feature/Change Request +Package: *General Issues
 [2013-07-12 12:41 UTC]
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Re-Opened". Thank you.

PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Jun 20 13:01:30 2024 UTC