sandozlabz Posted July 18, 2008 Share Posted July 18, 2008 How can I test if a function is already declared? If its declared skip declaration otherwise declare it. anyone? Quote Link to comment https://forums.phpfreaks.com/topic/115414-solved-test-if-function-already-declared/ Share on other sites More sharing options...
DeanWhitehouse Posted July 18, 2008 Share Posted July 18, 2008 can u not do if(!isset(Function)) { declare } Quote Link to comment https://forums.phpfreaks.com/topic/115414-solved-test-if-function-already-declared/#findComment-593302 Share on other sites More sharing options...
samshel Posted July 18, 2008 Share Posted July 18, 2008 bool function_exists ( string $function_name ) Quote Link to comment https://forums.phpfreaks.com/topic/115414-solved-test-if-function-already-declared/#findComment-593303 Share on other sites More sharing options...
sandozlabz Posted July 18, 2008 Author Share Posted July 18, 2008 sweet thank you both Quote Link to comment https://forums.phpfreaks.com/topic/115414-solved-test-if-function-already-declared/#findComment-593305 Share on other sites More sharing options...
unkwntech Posted July 18, 2008 Share Posted July 18, 2008 Give this a try: function_exists() <?php if(!function_exists(myFunctionName)) { function myFunctionName(myVar1, myVar2) { ... } } ?> More info here: http://www.php.net/manual/en/function.function-exists.php Quote Link to comment https://forums.phpfreaks.com/topic/115414-solved-test-if-function-already-declared/#findComment-593306 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.