note 69995 added to function.eval
| From: | Diz at osu1 dot php dot net | Date: | Fri, 29 Sep 2006 04:35:48 +0000 |
| Subject: | note 69995 added to function.eval | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-117817@lists.php.net to get a copy of this message | ||
This edits the little snipet bellow which doesn't work
<?php
// make some variables
$five = 5;
$three = 3;
$lessthan = "<";
// place them into a string
$mystring = "$five.$lessthan.$three"; // DOUBLE QUOTES
echo $mystring."<br>"; // lets see it before eval
if (eval("return ".$mystring.";")) // if(5<3)
{
echo "FALSE";
} else {
echo "TRUE";
}
?>
returns
FALSE
... of course
Notice that $mystring now has double quotes and works :)
incidentally this string could also be writen
<?php
$mystring = "$five $lessthan $three";
?>
without the points which also seems to work
----
Server IP: 85.116.0.130
Probable Submitter: 81.179.118.204
----
Manual Page -- http://www.php.net/manual/en/function.eval.php
Edit -- https://master.php.net/note/edit/69995
Del: integrated -- https://master.php.net/note/delete/69995/integrated
Del: useless -- https://master.php.net/note/delete/69995/useless
Del: bad code -- https://master.php.net/note/delete/69995/bad+code
Del: spam -- https://master.php.net/note/delete/69995/spam
Del: non-english -- https://master.php.net/note/delete/69995/non-english
Del: in docs -- https://master.php.net/note/delete/69995/in+docs
Del: other reasons-- https://master.php.net/note/delete/69995
Reject -- https://master.php.net/note/reject/69995
Search -- https://master.php.net/manage/user-notes.php