Runtime evaluation: Difference between revisions

Content added Content deleted
(PHP example (viva la reddit))
Line 251: Line 251:
'''
'''
10</lang>
10</lang>
=={{header|PHP}}==

The [http://www.php.net/eval eval construct] allow string evaluation as PHP code. Opening and closing tags are not required. Return statements immediatly terminates evaluation . Eval returns NULL, unless return is called in evalued code.
<lang php>
<?php
$code = 'echo "hello world"';
eval($code);
$code = 'return "hello world"';
print eval($code);
</lang>
=={{header|Ruby}}==
=={{header|Ruby}}==