I think you are looking for call_user_func
.
An example from the PHP Manual:
<?php
function barber($type) {
echo "You wanted a $type haircut, no problem";
}
call_user_func('barber', "mushroom");
call_user_func('barber', "shave");
?>
More Related Contents:
- How would I skip optional arguments in a function call?
- PHP Default Function Parameter values, how to ‘pass default value’ for ‘not last’ parameters?
- PHP function with variable as default value for a parameter
- What does this function returns exactly? [closed]
- how to make a function that validates fields in a form? php [closed]
- PHP function to generate v4 UUID
- PHP Fatal error: Using $this when not in object context
- Giving my function access to outside variable
- What is the difference between PHP echo and PHP return in plain English?
- PHP variables in anonymous functions
- Passing an Array as Arguments, not an Array, in PHP
- Round up to nearest multiple of five in PHP
- PHP append one array to another (not array_push or +)
- Autoloader for functions
- PHP check whether property exists in object or class
- PHP function use variable from outside
- Any way to specify optional parameter values in PHP?
- Get variables from the outside, inside a function in PHP
- PHP – Add link to a URL in a string
- Javascript and PHP functions
- RGB to closest predefined color
- Timeout a function in PHP
- Modify a globally scoped variable inside of an anonymous function
- How to alias a function in PHP?
- Use php namespace inside function
- Modify an Existing PHP Function to Return a String
- How can I execute PHP code from the command line?
- PHP call_user_func vs. just calling function
- PHP global or $GLOBALS
- How can you use php in a javascript function [duplicate]