You can call a user-defined function in PHP using a string variable that contains the function's name.

  • $function_name() or ${$function_name}()
  • $function_name;() or {$function_name;}()
  • $function_name[] or {$function_name}[]
  • $function_name{} or ${$function_name}{}
In PHP, you can call a user-defined function using a string variable that contains the function's name. The correct option is "$function_name() or ${$function_name}()" as it represents the valid syntax for calling a function with a string variable. By using the variable with parentheses () or curly brackets {}, you can invoke the function. The other mentioned options are not valid syntax for calling a function with a string variable in PHP. For further details, refer to the PHP documentation on variable functions: http://php.net/manual/en/functions.variable-functions.php
Add your answer
Loading...

Leave a comment

Your email address will not be published. Required fields are marked *