darkfreaks Posted December 29, 2008 Share Posted December 29, 2008 okay so i notice if i include a file that has a function on it then i include it again in another file. it throws a "cannot redeclare function" error, how do i avoid this ??? Link to comment https://forums.phpfreaks.com/topic/138755-solved-function-include-help/ Share on other sites More sharing options...
Mark Baker Posted December 29, 2008 Share Posted December 29, 2008 okay so i notice if i include a file that has a function on it then i include it again in another file. it throws a "cannot redeclare function" error, how do i avoid this By using include_once Link to comment https://forums.phpfreaks.com/topic/138755-solved-function-include-help/#findComment-725465 Share on other sites More sharing options...
trochia Posted December 29, 2008 Share Posted December 29, 2008 The code you furnished us, to look at...really helped !! So?? http://us3.php.net/results.php?q=cannot+redeclare+function&l=en&p=all Here's your answer !! :-) Link to comment https://forums.phpfreaks.com/topic/138755-solved-function-include-help/#findComment-725466 Share on other sites More sharing options...
darkfreaks Posted December 29, 2008 Author Share Posted December 29, 2008 i will try include_once dunno if it will work but the include is being called before any looping occurs. Link to comment https://forums.phpfreaks.com/topic/138755-solved-function-include-help/#findComment-725473 Share on other sites More sharing options...
CroNiX Posted December 29, 2008 Share Posted December 29, 2008 if(!function_exists(my_function)){ function my_function(){ .... } } Link to comment https://forums.phpfreaks.com/topic/138755-solved-function-include-help/#findComment-725475 Share on other sites More sharing options...
darkfreaks Posted December 29, 2008 Author Share Posted December 29, 2008 include_once worked thanks Link to comment https://forums.phpfreaks.com/topic/138755-solved-function-include-help/#findComment-725476 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.