Reputation: 4508
I have a function called check_nickname()
And I want to write something like this
$ttt='nickname';
check_.$ttt();
How can I do it correct ?
Upvotes: 0
Views: 57
Reputation: 157839
I would advise against that.
this will produce unmaintainable and undebuggable code.
I'd make one function which does all the verifications.
Upvotes: 3
Reputation:
$ttt = 'nickname';
$your_function = 'check_' . $ttt;
$your_function();
Upvotes: 0
Reputation: 324620
You would need to create another variable, such as $a = "check_".$ttt;
, then call $a();
Upvotes: 1
Reputation: 437336
Create a variable that holds the function name, and apply parentheses to it:
$ttt='nickname';
$funcname = 'check_'.$ttt;
$funcname();
Upvotes: 2