ionCube Logo
 FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 


 
Post new topic   Reply to topic    ionCube Forum Index -> Programming

Including a php file twice

Author Message
vignes92



Joined: 08 May 2011
Posts: 1

PostPosted: Sun May 08, 2011 8:10 pm    Post subject: Including a php file twice Reply with quote

Hello All,

I'm trying to include a php file twice which has a function. I also used function_exists() to prevent redeclaring the function on second include.

This works perfectly on Non encoded version. But after encoding the error was

Fatal error: Cannot redeclare
[!)&lt;9;-!','\!() (previously declared in /home/yyuew/public_html/demo/admin/modules/servers/cpanel.php:0) in <b>/home/yyuew/public_html/demo/admin/modules/servers/cpanel.php</b> on line <b>0

What might be the problem?
Any idea about this?
Thanks.
Back to top
View user's profile Send private message
websource



Joined: 09 May 2011
Posts: 1

PostPosted: Mon May 09, 2011 1:11 am    Post subject: Reply with quote

Instead of using include use include_once. I have the same thing happened yesterday and this solved the problem.
Back to top
View user's profile Send private message
liaison
ionCube Support


Joined: 16 Dec 2004
Posts: 2757

PostPosted: Wed May 11, 2011 10:51 am    Post subject: Reply with quote

include_once/require_once exist to avoid coding your own include guards, and should always be the type of include method used unless there is a good reason to use include/require.
_________________
Community Admin
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic    ionCube Forum Index -> Programming All times are GMT + 1 Hour
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum