Jump to content

exit from php


sarthak

Recommended Posts

hi guys,

I want to exit from a php file under some conditions like:

 

if ($reviewNumber>=1 )

{

echo "you have already reviewed this article";

exit 0;

}

<after this some php code>, What I want is it should exit the whole function if the code enters the if loop.

But putting exit 0 is giving me an error :syntax error, unexpected T_LNUMBER . Any solution

Also 1 thing i cannot work with  a return statement as the calling environment is AJAX and have to send the msg by echo only.

                            Pls help

 

 

Link to comment
https://forums.phpfreaks.com/topic/98592-exit-from-php/
Share on other sites

ya but I want to stop the execution of the next parts of the code. which if i put in side else will be very complex. Bcoz there are further similar checkings also done below and the number of such checking is around 15. Isnt there any alternative to a return statement. Which when encountered once will return the value and stop execution of further code?

Link to comment
https://forums.phpfreaks.com/topic/98592-exit-from-php/#findComment-504585
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.