|  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
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please — but make sure to vote on the bug!
Your email address:
Solve the problem:
48 - 12 = ?
Subscribe to this entry?

 [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-2022 The PHP Group
All rights reserved.
Last updated: Tue Jan 18 05:07:33 2022 UTC