How can wordpress function receive function as argument?

How can the WP function add_action receive another function as its argument? I know this by itself is not possible in php (to have custom functions receive other functions as arguments). I deliberately broke some code and found that there is actually a native php function call_user_fun_array beneath this (i think),

but how did they make it so that their own function can have a function as its argument?

Related posts

Leave a Reply

1 comment

  1. There is a native PHP function call_user_func() Take a look on this pretty simple example.

    function caller($custom_func){
    return call_user_func($custom_func);
    }
    function make_echo(){
    echo 'something';
    }
    
    caller('make_echo');