You are using this to prepare some output for writing to a .php include:
$var = "<?php\n\n\$$text = $var_str;\n\n?>";
While the approach is okay, you overlooked some syntax gotchas here.
First you wrote \$$text. This will result in a literal $ being kept in your $var output variable. But $text will be gone because it is interpolated into an empty string in your $var string.
$text was an undefined variable at this point in your code. Raise error_reporting() to E_ALL to notice such issues.
So in the end, this would become your output temps.php file:
<?php $ = 3; ?>
To get a proper variable name there, thus better use:
$var = "<?php \$text = $var_str; ?>";
# ^
(Just one escaped dollar sign here, no double $$.)
To make your code somewhat more safe to deploy, you should also escape or sanitize $var_str before (it was potentially user input). Use intval or var_export here:
$var_str = $_GET['t0'];
$var_str = var_export($var_str, 1);
$var = "<?php \$text = $var_str; ?>";
Then your output file becomes:
<?php $text = 3; ?>
But would also work for strings.
$_GET['t0']is already the input variable.($text, true)does not belong there. Where did you get that from?temps.phpa template file? Are you trying to create one .php script per page? Because just writing variables to one file and including it right back seems a bit longwinded by itself.