Re: return from the middle of a include file

From: Date: Wed, 26 Jul 2000 16:26:24 +0000
Subject: Re: return from the middle of a include file
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-8380@lists.php.net to get a copy of this message
> Have a question. How can I return from the middle of a include file ? > I have a php script calling package.inc which is 2000 lines. At the > beginning I check if package.inc has been included before. How can I > get out of the package.inc (php not pass the rest 2000 lines) ? > > Using return ? Instead of checking if the file was included before inside the actual include file, just check before including it. Something like this : // when including the first time $included = 1; include("somefile.inc"); // later on if (!$included) include("somefile.inc"); Regards, Joao

« previous php.general (#8380) next »