Stoping a PHP File [SOLVED]

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
tecktalkcm0391
DevNet Resident
Posts: 1030
Joined: Fri May 26, 2006 9:25 am
Location: Florida

Stoping a PHP File [SOLVED]

Post 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;?
Last edited by tecktalkcm0391 on Sun Jun 18, 2006 3:41 pm, edited 1 time in total.
User avatar
dethron
Forum Contributor
Posts: 370
Joined: Sat Apr 27, 2002 11:39 am
Location: Istanbul

Post by dethron »

exit(); will terminate all of the rest.
User avatar
tecktalkcm0391
DevNet Resident
Posts: 1030
Joined: Fri May 26, 2006 9:25 am
Location: Florida

Post 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?
User avatar
dethron
Forum Contributor
Posts: 370
Joined: Sat Apr 27, 2002 11:39 am
Location: Istanbul

Post by dethron »

why dont you try and see it?

it will only parse "Hello".

exit will terminate the rest of page.php
User avatar
tecktalkcm0391
DevNet Resident
Posts: 1030
Joined: Fri May 26, 2006 9:25 am
Location: Florida

Post by tecktalkcm0391 »

I dunno. ok well then what could I do to stop the codes in include.php and not page.php?
User avatar
dethron
Forum Contributor
Posts: 370
Joined: Sat Apr 27, 2002 11:39 am
Location: Istanbul

Post by dethron »

what exactly you want to do? i am sure there is a better way to do it.
User avatar
tecktalkcm0391
DevNet Resident
Posts: 1030
Joined: Fri May 26, 2006 9:25 am
Location: Florida

Post by tecktalkcm0391 »

yeah i just figured out another way thanks though.
Post Reply