Jump to content

[SOLVED] Exit out of function


jaymc

Recommended Posts

How can i exit out of a function to stop any code thereafter from executing, but carry on exectution the rest of the script?

 

function beans() {
echo "statement1 - ";
exit();
echo "statement2 - ";
}

beans();

echo "hello";

 

In that example I would like the output to be

 

statement1 - hello

at the moment it is

statement1 -

 

Link to comment
https://forums.phpfreaks.com/topic/144119-solved-exit-out-of-function/
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.