Created
November 15, 2024 12:05
-
-
Save shaunpalmer/f9b15bdb1e110bac981d608db75dbd89 to your computer and use it in GitHub Desktop.
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
// Initialize the class. | |
// Array of class names to instantiate | |
$classes = [ | |
'Ays_CPT_FAQ', | |
'Ays_CPT_Location', | |
'Ays_CPT_Review', | |
'Ays_CPT_Service', | |
'Ays_CPT_Team', | |
]; | |
foreach ($classes as $class) { | |
try { | |
// Dynamically instantiate the class | |
$instance = new $class(); | |
error_log("Successfully instantiated {$class}"); | |
} catch (Throwable $e) { | |
error_log("Failed to instantiate {$class}: " . $e->getMessage()); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment