Jump to content

Stop executing required script


dotkpay

Recommended Posts

Is there a way or function that stops the execution of a required script but continues to execute the parent script, for example:

 

if this is a.php

 

<?php

echo "<br>Good morning";

 

// function to stop execution of only this script to appear here

 

echo "<br>Good Afternoon";

?>

 

and then this is b.php

 

<?php

 

require("a.php');

 

echo "<br>Good Evening";

?>

 

So if the file b.php is called it is supposed to display:

 

Good morning

Good evening

 

So it has to skip "Good afternoon" because of the anonymous function which I need

Link to comment
https://forums.phpfreaks.com/topic/236619-stop-executing-required-script/
Share on other sites

You should not think of the required/included code as a separate script that is being 'called'. Think of it as source code (function definitions, class definitions, configuration information) that the main program needs to use to accomplish some goal.

 

When the require/include statement in the parent script is executed, the required/included code is executed in the scope of the parent script. The required/included code might be stored in a separate file and in a different folder, but when it is executed, it is the same as if you had copy/pasted the source code from the required/included file into the parent script at the point where the require/include statement is at.

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.