List Info

Thread: note 69993 added to function.eval




note 69993 added to function.eval
user name
2006-09-29 04:03:55
Thought I'd simplify the dynamic IF statement a little

<?php
// make some variables
$five = 5;
$three = 3;
$lessthan = "<";

// place them into a string
$mystring = '$five.$lessthan.$three';

echo $mystring."<br>"; // lets see it before
eval

if (eval("return ".$mystring.";")) //
if(5<3)
	{
	echo "FALSE";
} else {
	echo "TRUE";
}
?>

returns
FALSE
... of course
----
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/69993
Del: integrated  -- h
ttps://master.php.net/note/delete/69993/integrated
Del: useless     -- http
s://master.php.net/note/delete/69993/useless
Del: bad code    -- htt
ps://master.php.net/note/delete/69993/bad+code
Del: spam        -- https:/
/master.php.net/note/delete/69993/spam
Del: non-english -- 
https://master.php.net/note/delete/69993/non-english
Del: in docs     -- http
s://master.php.net/note/delete/69993/in+docs
Del: other reasons-- https://mast
er.php.net/note/delete/69993
Reject      -- https://mast
er.php.net/note/reject/69993
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 69993 deleted from function.eval by bobby
user name
2006-09-29 15:24:25
Note Submitter: Diz 

----

Thought I'd simplify the dynamic IF statement a little

<?php
// make some variables
$five = 5;
$three = 3;
$lessthan = "<";

// place them into a string
$mystring = '$five.$lessthan.$three';

echo $mystring."<br>"; // lets see it before
eval

if (eval("return ".$mystring.";")) //
if(5<3)
	{
	echo "FALSE";
} else {
	echo "TRUE";
}
?>

returns
FALSE
... of course

-- 
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 )