Created
October 23, 2013 06:11
-
-
Save monmon/7113323 to your computer and use it in GitHub Desktop.
phpでclassがないのにnewした場合にはExceptionではなくFatal error
This file contains 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 | |
class Monmon { | |
} | |
try { | |
$class = 'Monmon2'; | |
if (class_exists($class)) { // これがないと Fatal error: Class 'Monmon2' | |
$monmon2 = new $class(); | |
} | |
} catch (Exception $e) { | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment