Skip to content

Instantly share code, notes, and snippets.

@lsloan
Created June 10, 2015 20:56
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save lsloan/3a331dc14ad8f2c3c328 to your computer and use it in GitHub Desktop.
Save lsloan/3a331dc14ad8f2c3c328 to your computer and use it in GitHub Desktop.
<?php
/**
* Class ClassUtil
*
* Provide useful methods to overcome OOP shortcomings in some versions of PHP.
*/
class ClassUtil {
/**
* The "::class" notation isn't available until PHP 5.5. This method is a workaround for
* older versions of PHP.
*
* @return string Name of this class
*/
static public function className() {
return get_called_class();
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment