file_get_contents doesn't get the whole local file if it strats with <?

Viewed 24

I'm basically trying to get the contents of my local PHP file in the same directory but it doesn't work because the wanted file starts with '<?';

If the wanted file's first two characters are <? - it doesn't work. If any other - no problem.

But I really need to get the contents of file that starts with <? as any normal php file.

file 1:

<?
$file = file_get_contents('file2.php');
$file = str_replace('anything', 'something', $file );
file_put_contents('file2.php', $file);
?>

file 2:

<?
$anything = 'anything';
?>
0 Answers
Related