Skip to content

Instantly share code, notes, and snippets.

@Paladin
Last active December 15, 2015 14:19
Show Gist options
  • Save Paladin/5273393 to your computer and use it in GitHub Desktop.
Save Paladin/5273393 to your computer and use it in GitHub Desktop.
Not sure how "more code" helps, Joel, but...
$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?
@Paladin
Copy link
Author

Paladin commented Mar 29, 2013

It looks so ugly, and seems so inconsistent, but then, this is PHP we're talking about.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment