为什么代码在此功能后停止工作?

I have some other functions and a html page call after this simple function, but they dont run after this.

function page($name){
  $content =<<<eol
<?php
PAGE CONTENT
?>
 eol;
$file = "./search/$name.php";
$open = fopen($file, "w");
fwrite($open, $content);
fclose($open);
    }

function works itself, but causes exiting code.

<?php
function page($name){
    $content = '<?php PAGE CONTENT ?>';

    $file = "./search/$name.php";
    $open = fopen($file, "w");
    fwrite($open, $content);
    fclose($open);
}

page('file1.txt');
?>

Just see if that works, It could be something to do with your HEREDOC syntax (maybe the space before the eol;).

I disagree with Chief17 The only right thing is writing to file.

This code

<?php
PAGE CONTENT
?>

what supposed to do?

Did you mix up ??? may be it should be like this

?>
PAGE CONTENT
<?php

editing after your edit

You break the php like this why you need this anyway?