Last active
December 15, 2015 14:19
-
-
Save Paladin/5273393 to your computer and use it in GitHub Desktop.
Not sure how "more code" helps, Joel, but...
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$fred = "Joe"; | |
$fred::myName(); // makes a static call to Joe::myname(); | |
class Sam | |
{ | |
public $fred = "Joe"; | |
function whoAreYou() | |
{ | |
$this->fred::myName(); // Erors out with unexpected :: error | |
} | |
} | |
class George | |
{ | |
public $fred = "Joe"; | |
function whoAreYou() | |
{ | |
$fred = $this->fred; | |
$fred::name(); // calls Joe::name() successfully | |
} | |
} | |
Why does George's syntax work but not Sam's? What do I do to Sam's to make it work? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It looks so ugly, and seems so inconsistent, but then, this is PHP we're talking about.