How to use call_user_func() to call static class method in PHP

2 Answers

0 votes
class cl {
    static function s_func() {
        echo "PHP OOP";
    }
}

call_user_func(array('cl', 's_func'));


 
/*
run: 

PHP OOP 

*/

 



answered Jun 3, 2016 by avibootz
0 votes
class cl {
    static function s_func() {
        echo "PHP OOP";
    }
}

call_user_func('cl::s_func');


 
/*
run: 

PHP OOP 

*/

 



answered Jun 3, 2016 by avibootz
...