PHP eval equivalent to include

The PHP include statement includes and evaluates a specific file, not what if we want to modify that file first before including, i.e. a version template file.

Well this can be done with PHP eval.

I file is included as follows;

include myfile.php

Using eval, we can achieve the same as above as follows;

$inc = file_get_contents('myfile.php');
eval("?>".$inc);

Posted

in

by

Tags:

Comments

Leave a Reply

Your email address will not be published. Required fields are marked *