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 #175929 is a reply to message #175926] Tue, 08 November 2011 10:27 Go to previous messageGo to previous message
Graham is currently offline  Graham
Messages: 4
Registered: November 2011
Karma:
Junior Member
"Denis McMahon" <denismfmcmahon(at)gmail(dot)com> wrote in message
news:4eb8fcf9$0$28445$a8266bb1(at)newsreader(dot)readnews(dot)com...
> 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

I hang my head in shame! Thinking about it, i've been critised for top
posting before, but couldn't remember the drill as I post to newsgroups so
rarely. Thanks for being patient and polite (unlike some). And thanks for
the very thorough explanation which I now follow.

R's
Graham Stow
[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:54:20 GMT 2024

Total time taken to generate the page: 0.28404 seconds