In PHP, how to call a function by its name as a string? The name strings may be known only at run time.
If the string containing the function name is
$func, you may call the function like
call_user_func() function supports more usage patterns, like
call_user_func( array($obj,$func), $params )
to call object
$obj‘s function named
$func with parameters
- This reply was modified 6 months, 1 week ago by Eric Z Ma.