FUDforum
Fast Uncompromising Discussions. FUDforum will get your users talking.

Home » Imported messages » comp.lang.php » PHP Newbie can't evaluate numerical string as number
Show: Today's Messages :: Polls :: Message Navigator
Return to the default flat view Create a new topic Submit Reply
Re: PHP Newbie can't evaluate numerical string as number [message #175926 is a reply to message #175925] Tue, 08 November 2011 09:57 Go to previous messageGo to previous message
Denis McMahon is currently offline  Denis McMahon
Messages: 634
Registered: September 2010
Karma:
Senior Member
On Tue, 08 Nov 2011 09:35:02 +0000, Graham wrote:

> Yes it works! (although I admit I'm not entirely sure why). Many thanks!
> And apologies to Denis for having doubted him.

Heads up - we don't top post in newsgroups. Reply goes at the bottom so
that reading naturally down the page response is after the comment it
applies to.

If you read the php manual for eval http://uk.php.net/manual/en/
function.eval.php , all is explained:

There are two ways to get a value from eval into the script that calls
eval:

a) use return inside the eval code, and assign the value of eval to a
variable, viz:

$evalResult = eval("return $big_number - $small_number;");
echo $evalResult;

b) assign the result to a variable inside the eval code:

eval("$evalResult = $big_number - $small_number;");
echo $evalResult;

These are the two methods I attempted to show in my example.

Rgds

Denis McMahon
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: shiping cart program
Next Topic: he discount UGG boots are best known for its "Classic" sheepskin boots.
Goto Forum:
  

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ]

Current Time: Wed Nov 27 09:47:39 GMT 2024

Total time taken to generate the page: 0.04321 seconds