Skip to content

Instantly share code, notes, and snippets.

@ejdanderson
Last active October 2, 2015 03:38
Show Gist options
  • Save ejdanderson/2165814 to your computer and use it in GitHub Desktop.
Save ejdanderson/2165814 to your computer and use it in GitHub Desktop.
differences in class name references
<?php
class Foo {
function echo_classes() {
echo __CLASS__;
echo get_class();
echo get_class($this);
echo get_called_class();
}
}
class Bar extends Foo{}
$bar = new Bar();
$bar->echo_classes();
/** OUTPUT **/
// Foo
// Foo
// Bar
// Bar
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment