Created
May 21, 2013 01:09
-
-
Save dg/5616877 to your computer and use it in GitHub Desktop.
Workaround for missing ::class in PHP < 5.5
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Nette\Http; | |
echo Http\Request::class; // prints 'Nette\Http\Request' since PHP 5.5 | |
echo Http\Request\type::of; // prints 'Nette\Http\Request' alwyas ;) | |
// workaround | |
function __autoload($c) | |
{ | |
$c = substr($c, 0, -5); | |
eval("namespace $c;class type{const of='$c';}"); | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment