Network_ninja Posted November 3, 2011 Share Posted November 3, 2011 Is there a way in php to not execute the whole script if there is error on the script? For example: <?php execute script here; .......... ........... [b] error encounter here[/b]. -> error is not logical execute script ............. ............. ?> I don't want to execute the above script... tnx everyone. Quote Link to comment https://forums.phpfreaks.com/topic/250351-php-execution-help/ Share on other sites More sharing options...
trq Posted November 3, 2011 Share Posted November 3, 2011 Check for errors using an if statement. This is always good practice. Quote Link to comment https://forums.phpfreaks.com/topic/250351-php-execution-help/#findComment-1284539 Share on other sites More sharing options...
phporcaffeine Posted November 3, 2011 Share Posted November 3, 2011 When the interpreter parses the script into opcode, it checks the script for runtime errors, rather errors that would prevent the script from running. The script will not execute entirely, if it contains syntactical (parse) errors (i.e forgot a ";" at the end of a line ... etc). The Interpreter loads a script and executes it start to finish, so anything in the general namespace (code that will execute regardless of condition) that contains an error will throw a flag in the interpreter right away. If however, there is an error in a conditional namespace (code that only executes under certain conditions ... i.e. functions), a flag is only thrown in the interpreter when something from general namespace references the error in the conditional namespace. Generally, the script will continue execution under all flags except fatal errors. Quote Link to comment https://forums.phpfreaks.com/topic/250351-php-execution-help/#findComment-1284579 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.