Answers for "php pass function as callback"

PHP
0

php pass function as callback

<?php

// An example callback function
function my_callback_function() {
    echo 'hello world!';
}

// An example callback method
class MyClass {
    static function myCallbackMethod() {
        echo 'Hello World!';
    }
}

// Type 1: Simple callback
call_user_func('my_callback_function');

// Type 2: Static class method call
call_user_func(array('MyClass', 'myCallbackMethod'));
Posted by: Guest on July-21-2021

Code answers related to "php pass function as callback"

Browse Popular Code Answers by Language