note 102026 rejected from language.oop5.paamayim-nekudotayim by joey
| From: | joey@php.net | Date: | Mon, 28 Nov 2011 04:35:15 +0000 |
| Subject: | note 102026 rejected from language.oop5.paamayim-nekudotayim by joey | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-184701@lists.php.net to get a copy of this message | ||
Note Submitter: wes [at] sdynamics [dat] com
----
Important to note that scope resolution operator can have unexpected effects on the meaning of $this
in a remote context.
<?php
// Tested in PHP 5.3.3
class Alpha {
function whoisbeta() {
return Beta::whoami();
}
}
class Beta {
function whoami() {
return get_class($this);
}
}
$a = new Alpha();
echo implode(', ', array(
Beta::whoami(), // Beta
Alpha::whoisbeta(), // Beta
$a->whoisbeta(), // Alpha (?!?!)
));
?>