M.O.S. Studios Posted July 21, 2010 Share Posted July 21, 2010 Im using eval() function. i need the script being ran by eval() to recognize constants from the global scope. for example: <?php define('FOO', 'BAR', TRUE); eval('echo FOO'); ?> i need that to display BAR any ideas? Quote Link to comment https://forums.phpfreaks.com/topic/208429-using-constats-from-the-gloabal-scope-within-eval/ Share on other sites More sharing options...
PFMaBiSmAd Posted July 21, 2010 Share Posted July 21, 2010 The php code you put into the eval() must be valid php code, your's is missing the ; on the end of the php statement. The fatal error you got should have alerted you to what was wrong - Parse error: syntax error, unexpected $end, expecting ',' or ';' in your_file.php(4) : eval()'d code on line 1 Quote Link to comment https://forums.phpfreaks.com/topic/208429-using-constats-from-the-gloabal-scope-within-eval/#findComment-1089163 Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.