Req #15232 [Opn->NoF]: Need a possibility to compare two references
| From: | maarten@php.net | Date: | Fri, 12 Jul 2013 12:41:24 +0000 |
| Subject: | Req #15232 [Opn->NoF]: Need a possibility to compare two references | ||
| References: | 1 | Groups: | php.bugs |
| Request: | Send a blank email to php-bugs+get-180217@lists.php.net to get a copy of this message | ||
Edit report at https://bugs.php.net/bug.php?id=15232&edit=1
ID: 15232
Updated by: maarten@php.net
Reported by: flying at dom dot natm dot ru
Summary: Need a possibility to compare two references
-Status: Open
+Status: No Feedback
Type: Feature/Change Request
-Package: Feature/Change Request
+Package: *General Issues
Operating System: All
PHP Version: 4.0.6
Block user comment: N
Private report: N
New Comment:
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.
Previous Comments:
------------------------------------------------------------------------
[2011-08-23 14:19:43] datibbaw@php.net
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
optimization)
For objects you could use the equality operator (===). For example:
$a = new mynumber(5);
$b = new mynumber(5);
echo $a === $b;
------------------------------------------------------------------------
[2002-01-26 06:18:25] 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.
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=15232&edit=1