class - Define classes based on variables in PHP -


so, i'm developing webapp under own mvc structure , controller classes defined inside own files, e.g.: homecontroller defined inside homecontroller.php. question is: possible automatically define class based on file name? like, tried catch filename using file, define class based on that.

$path = __file__; // "c:.../app/controller/homecontroller.php"  $array = explode(directory_separator, $path); array_pop($array); // in order remove "homecontroller.php" $class = end($array); // controller  $classname = 'home'.$class; class $classname {} // not working, possible or not? 

short answer: no.

long answer: cannot way want to. create code creates php file , generates boilerplate class template.


Comments

Popular posts from this blog

php - Wordpress website dashboard page or post editor content is not showing but front end data is showing properly -

javascript - Get parameter of GET request -

javascript - Twitter Bootstrap - how to add some more margin between tooltip popup and element -