PDA

Click to See Complete Forum and Search --> : [RESOLVED] Stop PHP file executing


Pino
Feb 7th, 2006, 12:17 PM
Can i do this? what would be the correct syntax?

If somthing
{

} else
{

exit do not execute anything more

}

Thankjs

sciguyryan
Feb 7th, 2006, 01:44 PM
I'm not shure what you are asking, stop part of the code from executing or stopping the file from being processed at all?

Cheers,

Ryan Jones

Pino
Feb 7th, 2006, 01:46 PM
sorry say we have this.....

If this is true {

do this

}else{

stop execution of all the file below

}

more commands, on executed if above was true.

basicly and exit sub kind of thing

Thanks

sciguyryan
Feb 7th, 2006, 01:51 PM
Ah, I understand now :)

Something like this?


if ($Something)
{
echo 'Looks like you can continue then!';
}
else
{
echo 'Sorry you can go no further!';
exit(0);
}

# Anything down here will only execute if the above IF statement was true.


Cheers,

Ryan Jones

Pino
Feb 7th, 2006, 01:54 PM
i knew it would be somthing simple. Thanks

sciguyryan
Feb 7th, 2006, 01:56 PM
i knew it would be somthing simple. Thanks

PHP makes many things simple, when you know what the things are :)

There is another called die(); that allows you to do the same thing.

Cheers,

Ryan Jones