php - Passing zero parameters to call_user_func_array -


consider following situation:

call_user_func_array(array($this, 'method'), array()); 

this works fine, i'm wondering whether right way pass zero parameters method. i've tried passing null instead of array(), gives me error.

question: right way pass 0 arguments method called call_user_func_array?

yes, can use call_user_func. see example

<?php class myclass {      public function callablefunc()     {         echo "called" . php_eol;     }      public function call()     {         echo "calling callable other function" . php_eol;         call_user_func(array($this, 'callablefunc'));     }  }  $class = new myclass;  call_user_func(array($class, 'callablefunc')); $class->call(); 

Comments

Popular posts from this blog

Android layout hidden on keyboard show -

google app engine - 403 Forbidden POST - Flask WTForms -

c - Why would PK11_GenerateRandom() return an error -8023? -