blueman378 Posted February 6, 2008 Share Posted February 6, 2008 hi guys i was wondering is it posasible to have a function with a variable name? like $cat1 = "abc"; function $cat1() cheers Quote Link to comment https://forums.phpfreaks.com/topic/89688-variable-function-names/ Share on other sites More sharing options...
Cep Posted February 6, 2008 Share Posted February 6, 2008 Hmm technically it is but you need to have a variable value that matches a function with the name, <?php function foo() { echo "In foo()<br />\n"; } $func = 'foo'; $func(); // This calls foo() Its not an area I am brilliant at but its in the manual under functions. Quote Link to comment https://forums.phpfreaks.com/topic/89688-variable-function-names/#findComment-459589 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.