Problem with circular include statement

From: Date: Wed, 28 Jul 2004 04:44:46 +0000
Subject: Problem with circular include statement
Groups: php.general 
Request: Send a blank email to php-general+get-192064@lists.php.net to get a copy of this message
Hello all, I have 3 scripts script1.php and script2.php where both include the same general.inc file of functions. Then I have script3.php that calls functions from both scritp1.php and script2.php. As both script1 and script2 include general.inc when I try to use diferent function on script3 I have a circular problem that functions on general.inc are declared twice. Therefore, how can I solve this circular include problem? Can anyone help me? In C++ you have the pragma keyword to avoid this. What can be done in PHP? When I do a include_once() the problem stays the same. Thanks in advance. Here's the scenario in case what I wrote is complicated. script1.php : <?php include("general.inc"); functions...... ?> script2.php : <?php include("general.inc"); functions...... ?> script3.php : <?php include("script1.php"); include("script2.php"); call script1 functions call script2 functions functions...... ?>

« previous php.general (#192064) next »