Page 1 of 1
Stoping a PHP File [SOLVED]
Posted: Sun Jun 18, 2006 3:14 pm
by tecktalkcm0391
How do you stop a file that is included with out stoping the code that includes the file, or will that now happen when you use exit;?
Posted: Sun Jun 18, 2006 3:19 pm
by dethron
exit(); will terminate all of the rest.
Posted: Sun Jun 18, 2006 3:22 pm
by tecktalkcm0391
Everything even on the included file and the file that includes...
This is an example of basically what I have:
Page.php
Code: Select all
<?php
include("include.php");
print("Finished");
?>
and include.php
<?php
if(1=1){
print("Hello");
exit;
} else {
print("bye");
?>
Will the exit terminate the print on page.php?
Posted: Sun Jun 18, 2006 3:25 pm
by dethron
why dont you try and see it?
it will only parse "Hello".
exit will terminate the rest of page.php
Posted: Sun Jun 18, 2006 3:34 pm
by tecktalkcm0391
I dunno. ok well then what could I do to stop the codes in include.php and not page.php?
Posted: Sun Jun 18, 2006 3:37 pm
by dethron
what exactly you want to do? i am sure there is a better way to do it.
Posted: Sun Jun 18, 2006 3:40 pm
by tecktalkcm0391
yeah i just figured out another way thanks though.