Skip to content

Instantly share code, notes, and snippets.

@kjohnson
Created April 12, 2015 08:58
Show Gist options
  • Select an option

  • Save kjohnson/0b263f12d3c2054ea627 to your computer and use it in GitHub Desktop.

Select an option

Save kjohnson/0b263f12d3c2054ea627 to your computer and use it in GitHub Desktop.
class test {
const HELLO = 'Hello';
}
class test1 extends test {
const HELLO = 'Hello, test1';
}
class test2 extends test {
const HELLO = 'Hello, test2';
}
$test = new test();
$test1 = new test1();
$test2 = new test2();
echo $test::HELLO . "\r\n";
echo $test1::HELLO . "\r\n";
echo $test2::HELLO . "\r\n";
/**
* RESULT
* ------------
* Hello
* Hello, test1
* Hello, test2
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment