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? 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 } 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 ) 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 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 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
Archived
This topic is now archived and is closed to further replies.