Skip to content

Instantly share code, notes, and snippets.

@loganlinn
Created March 29, 2012 00:09
Show Gist options
  • Save loganlinn/2231699 to your computer and use it in GitHub Desktop.
Save loganlinn/2231699 to your computer and use it in GitHub Desktop.
<?php
class Foo {
const NUM_FOOS = 42;
}
class Bar {
public $foo;
function __construct() {
$this->foo = new Foo();
$f = $this->foo;
echo $f::NUM_FOOS; // Works
//echo $this->foo::NUM_FOOS; // Parse error
//echo $this->getFoo()::NUM_FOOS; // Parse error
}
function getFoo() {
return $this->foo;
}
}
$b = new Bar();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment