Advertisement
Danack

OSX case sensitivity.

Jul 14th, 2013
173
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. $className = "Monolog\Logger";
  2. $lowerCase = mb_strtolower($className);
  3.  
  4. try{
  5. $reflectionClass = new ReflectionClass($lowerCase);
  6. echo "reflectionClass = : ".$reflectionClass."\n";
  7. }
  8. catch (Exception $e){
  9. echo "Class doesn't exist: " . $e->getMessage()."\n";
  10. }
  11.  
  12. try {
  13. $reflectionClass = new ReflectionClass($className);
  14. echo "But this works.\n";
  15.  
  16. $reflectionClass = new ReflectionClass($lowerCase);
  17. echo "And now so does this.\n";
  18. }
  19. catch(Exception $e) {
  20. echo "Class doesn't exist: " . $e->getMessage()."\n";
  21. }
  22.  
  23. // The above outputs:
  24. //
  25. // Class doesn't exist: Class monolog\logger does not exist
  26. // But this works.
  27. // And now so does this.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement