I am using Codeigniter for a project and i usually call a series of models (let’s say controllerA -> modelA -> modelB -> modelC) for some work. I want the php to stop executing when it reaches some exception where i invoke the exit() command. Now, if the command exit() is invoked in modelB, will it stop execution of only the script of modelB and continue executing rest of the modelA? Or will it stop the entire execution flow.
I really don’t know how to put this question here. The question looks quite messy. Please let me know should i need to revise the question itself.
Yes,
exitstops all script execution immediately, regardless where you call it.The opposite is
returnwhich only stops execution of the current function (or current file when used at global level in an included file)Read more here: https://stackoverflow.com/a/9853554/43959