Code:
<?
function myLoadFileInString($filename)
{
$res = "";
if (!file_exists($filename))
return $res;
$lines = file($filename);
foreach ($lines as $line_num => $line)
{
$res = $res . $line;
}
return $res;
};
$var1 = 'hahah';
$test = myLoadFileInString( 'test.htm' );
$test = str_replace( '$var1', $var1, $test );
echo "$test";
?>
Code:
<tr>
<td><div align="center">$var1</div></td>
<td><div align="center">$var2</div></td>
<td><div align="center">$var3</div></td>
<td><div align="center"></div></td>
</tr>
Jetzt will, dass es automatisch ersezt wird, die Variable $var1, ohne dass ich den VariablenName kenne. -> $test = do_replace( $var1, $test);