[PHP] Re: HELP!! how can arithmetic variables(string) ??
LKSunny wrote: ? $a=1+1; //variables(string) //how can arithmetic variables(string) ?? //N ROW //output echo $a //i need output 2 not 1+1 //Please Help, Thank You Very Much !! ? You can do: eval(echo $a;); But be warned, this has Injection Attack written all over it! Col -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Re: HELP!! how can arithmetic variables(string) ??
Thank You ! Colin Guthrie [EMAIL PROTECTED] ¼¶¼g©ó¶l¥ó·s»D:[EMAIL PROTECTED] LKSunny wrote: ? $a=1+1; //variables(string) //how can arithmetic variables(string) ?? //N ROW //output echo $a //i need output 2 not 1+1 //Please Help, Thank You Very Much !! ? You can do: eval(echo $a;); But be warned, this has Injection Attack written all over it! Col -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: HELP!! how can arithmetic variables(string) ??
Colin Guthrie wrote: LKSunny wrote: ? $a=1+1; //variables(string) //how can arithmetic variables(string) ?? //N ROW //output echo $a //i need output 2 not 1+1 //Please Help, Thank You Very Much !! ? You can do: eval(echo $a;); you realise Sunny stopped reading at this point. some people should not be given guns. ;-) But be warned, this has Injection Attack written all over it! Col -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Re: HELP!! how can arithmetic variables(string) ??
On 10/18/07, Jochem Maas [EMAIL PROTECTED] wrote: Colin Guthrie wrote: LKSunny wrote: ? $a=1+1; //variables(string) //how can arithmetic variables(string) ?? //N ROW //output echo $a //i need output 2 not 1+1 //Please Help, Thank You Very Much !! ? You can do: eval(echo $a;); you realise Sunny stopped reading at this point. some people should not be given guns. ;-) a much safer technique is to restrict the options on the input and define a custom function that has expectations based upon those restrictions: function addStringPieces($stringWAddition) { $addComponents = explode('+', $stringWAddition); return $addComponents[0] + $addComponents[1]; } php echo addStringPieces('1+1'); 2 -nathan