title: How to get scripts output and process in another script in PHP using ob_start?
body: <p>OK look:</p>
  
  <p>What I want to do is the following (this is an example):</p>
  
  <ol>
  <li>$output = require( "script_execution.php" );</li>
  <li>echo str_replace( "hello", "bye", $output );</li>
  </ol>
  
  <p>The solution I have:</p>
  
  <p>(script_execution.php)</p>
  
  <pre><code>&lt;?php
     echo "hello world....";
  ?&gt;
  </code></pre>
  
  <p>(solution.php)</p>
  
  <pre><code>&lt;?php
  
    ob_start();
    require( "script_execution.php" );
    $output = ob_get_contents();
    ob_end_clean();
    echo $output; // WOW!!! but.......................
  
  ?&gt;
  </code></pre>
  
  <p>(output)</p>
  
  <p><strong>bye world....</strong></p>
  
  <p>Here is the problem: That solution works fine but, ¿What happens if "script_execution.php" has an (exit;) ??? 
  The final output will be wrong because before the third instruction all execution running is stopped.</p>
  
  <p>¿What can I do to get the final output of "script_execution.php" without exit my script (solution.php)? Because as you know, the final output of script_execution.php (independent of the exit; instruction) is:</p>
  
  <p><strong>hello world....</strong></p>
  
  <p>Thanks! (maybe using threads??)</p>