|
php.net | support | documentation | report a bug | advanced search | search howto | statistics | random bug | login |
PatchesPull RequestsHistoryAllCommentsChangesGit/SVN commits
[2002-06-17 17:01 UTC] hholzgra@php.net
[2002-07-31 09:25 UTC] iliaa@php.net
|
|||||||||||||||||||||||||||||||||
Copyright © 2001-2025 The PHP GroupAll rights reserved. |
Last updated: Thu Nov 06 05:00:01 2025 UTC |
Check out these simple examples: Example 1: ----------------------------------------------------- <?php function getCode() { return("echo 'hello world!';"); }; eval(getCode()); ?> ----------------------------------------------------- Result of executing whis example will be a string 'hello world!' as expected. Example 2: ----------------------------------------------------- <?php define('PHP_CODE','getCode()'); function getCode() { return("echo 'hello world!';"); }; eval(PHP_CODE); ?> ----------------------------------------------------- As you can see - i just move code from eval() into constant and substitute it with constant name instead of actual code into eval() statement. But result of executing this example is: Parse error: parse error in test.php(9) : eval()'d code on line 1 Tested with both 4.0.6 and 4.1.1 on windows 2000 and linux.