note 103697 rejected from language.types.string by danbrown
| From: | danbrown@php.net | Date: | Thu, 28 Apr 2011 17:01:00 +0000 |
| Subject: | note 103697 rejected from language.types.string by danbrown | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-179242@lists.php.net to get a copy of this message | ||
Note Submitter: Ultimater at gmail dot com
----
I'm having trouble getting jeff at kingdesk dot com's code to work -- PHP's eval
function is slightly different from what you learn in JavaScript's -- although the concept is
good.
$e->val can also be replaced with $eval like so:
<?php
$eval='evaluate';
function evaluate($str)
{
return eval("return $str;");
}
echo "2 + 2 = {$eval('2+2')}";
?>