Jump to content

Exit Function Early


bsmither

Recommended Posts

There is a function (that cannot be changed) which has an include:

 

<?php
function a() {
  include 'file.php';
  echo 'work';
}
?>
 
==file.php==
<?php
echo 'play';
## Need to leave a() now!
?>

The included file can be changed.

 

I would like a way for file.php to cause PHP to return out of the function a(). A return; statement in file.php has PHP pick up execution with the statement following include.

 

What is there in PHP that will allow returning out of a() at some point in file.php?

 

Link to comment
https://forums.phpfreaks.com/topic/290191-exit-function-early/
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.