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 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. Link to comment https://forums.phpfreaks.com/topic/89688-variable-function-names/#findComment-459589 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.