List Info

Thread: note 69995 added to function.eval




note 69995 added to function.eval
user name
2006-09-29 04:35:48
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  -- h
ttps://master.php.net/note/delete/69995/integrated
Del: useless     -- http
s://master.php.net/note/delete/69995/useless
Del: bad code    -- htt
ps://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     -- http
s://master.php.net/note/delete/69995/in+docs
Del: other reasons-- https://mast
er.php.net/note/delete/69995
Reject      -- https://mast
er.php.net/note/reject/69995
Search      -- https://
master.php.net/manage/user-notes.php

-- 
PHP Notes Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php

note 69995 deleted from function.eval by bobby
user name
2006-09-29 15:23:48
Note Submitter: Diz 

----

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

-- 
PHP Notes Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub
.php

[1-2]

about | contact  Other archives ( Real Estate discussion Medical topics )