Merve wrote:[man]eval/man
eval() reads a string as PHP code. That's how it works. I can't really understand what your problem is aside from that.
sorry i didnt make it clear, I'm trying to read a tpl file and output it to php(html) format, but with the eval function that i used, it didnt work with two dimension array.
for example the tpl might look like following(test.tpl):
<table>
<tr>
<td> my name is $temp['name']['first'] </td>
<td> i'm $temp['name']['age'] </td>
</tr>
</table>
the php file might look like following (test.php):
.
.
.
$temp['name']['first'] = 'Michael';
$temp['name']['age'] = '20';
$original_file_array= file("test.tpl");
$file_size = sizeof($original_file_array);
$structure_counter = 0;
while($file_size > $structure_counter)
{
$compile_line = $original_file_array[$structure_counter];
eval("\$compile_line=\"$compile_line\";");
echo $compile_line;
$structure_counter++;
}
hope this can demonstrate the question more clearly 😃