Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.php > #3717
| From | "Graham" <graham.stow@stowassocs.co.uk> |
|---|---|
| Newsgroups | comp.lang.php |
| References | <A8OdnXgegKYUmyXTnZ2dnUVZ7ridnZ2d@bt.com><4eb81acf$0$28518$a8266bb1@newsreader.readnews.com><f_qdnUg0B6m_diXTnZ2dnUVZ8qudnZ2d@bt.com><4eb8eed0$0$6947$e4fe514c@news2.news.xs4all.nl><O5SdndpZ6bFXaiXTnZ2dnUVZ7ridnZ2d@bt.com> <4eb8fcf9$0$28445$a8266bb1@newsreader.readnews.com> |
| Subject | Re: PHP Newbie can't evaluate numerical string as number |
| Date | 2011-11-08 10:27 +0000 |
| Message-ID | <ycydnRhvecuwmSTTnZ2dnUVZ8sednZ2d@bt.com> (permalink) |
"Denis McMahon" <denismfmcmahon@gmail.com> wrote in message
news:4eb8fcf9$0$28445$a8266bb1@newsreader.readnews.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
Back to comp.lang.php | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
PHP Newbie can't evaluate numerical string as number "Graham" <graham.stow@stowassocs.co.uk> - 2011-11-07 16:25 +0000
Re: PHP Newbie can't evaluate numerical string as number The Natural Philosopher <tnp@invalid.invalid> - 2011-11-07 16:56 +0000
Re: PHP Newbie can't evaluate numerical string as number Denis McMahon <denismfmcmahon@gmail.com> - 2011-11-07 17:52 +0000
Re: PHP Newbie can't evaluate numerical string as number "Graham" <graham.stow@stowassocs.co.uk> - 2011-11-08 08:41 +0000
Re: PHP Newbie can't evaluate numerical string as number Erwin Moller <Since_humans_read_this_I_am_spammed_too_much@spamyourself.com> - 2011-11-08 09:56 +0100
Re: PHP Newbie can't evaluate numerical string as number "Graham" <graham.stow@stowassocs.co.uk> - 2011-11-08 09:35 +0000
Re: PHP Newbie can't evaluate numerical string as number Denis McMahon <denismfmcmahon@gmail.com> - 2011-11-08 09:57 +0000
Re: PHP Newbie can't evaluate numerical string as number Tim Streater <timstreater@greenbee.net> - 2011-11-08 10:08 +0000
Re: PHP Newbie can't evaluate numerical string as number Denis McMahon <denismfmcmahon@gmail.com> - 2011-11-08 17:49 +0000
Re: PHP Newbie can't evaluate numerical string as number "Graham" <graham.stow@stowassocs.co.uk> - 2011-11-08 10:27 +0000
Re: PHP Newbie can't evaluate numerical string as number Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2011-11-07 23:49 +0100
Re: PHP Newbie can't evaluate numerical string as number Jonathan Stein <jstein@image.dk> - 2011-11-08 11:19 +0100
csiph-web