Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- $className = "Monolog\Logger";
- $lowerCase = mb_strtolower($className);
- try{
- $reflectionClass = new ReflectionClass($lowerCase);
- echo "reflectionClass = : ".$reflectionClass."\n";
- }
- catch (Exception $e){
- echo "Class doesn't exist: " . $e->getMessage()."\n";
- }
- try {
- $reflectionClass = new ReflectionClass($className);
- echo "But this works.\n";
- $reflectionClass = new ReflectionClass($lowerCase);
- echo "And now so does this.\n";
- }
- catch(Exception $e) {
- echo "Class doesn't exist: " . $e->getMessage()."\n";
- }
- // The above outputs:
- //
- // Class doesn't exist: Class monolog\logger does not exist
- // But this works.
- // And now so does this.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement