I have inside my php code
var_dump($var);
$var ='
<script type="text/javascript">
'.$var.'
</script>'
;
var_dump($var);
The first var_dump displays correctly some value, but the second displays an empty string.
Notice: Undefined variable: var in /code/IdpgMo on line 3
NULL
Notice: Undefined variable: var in /code/IdpgMo on line 7
string(50) ” ” PHP Notice: Undefined variable: var in /code/IdpgMo on line 3 PHP Notice: Undefined variable: var in /code/IdpgMo on line 7
Why is it so?
It is because your browser is handling it like it is a script.
Scripts are not shown they are run so the script is in your source not displayed on screen