PHP is really nifty in the way you can instantiate classes by using string variables like so:
Expand|Select|Wrap|Line Numbers
- $str_class_name = 'User';
- $instance = new $str_class_name();
My question is whether there is a way to do this for static methods of a class.
so something like:
Expand|Select|Wrap|Line Numbers
- class User {
- public static function get_all(){
- return "calling get_all from user";
- }
- }
- $class_name = 'User';
- $class_name::get_all();
best regards
Rythmic