|
|
|
|
||||||
![]() |
|
|
LinkBack | Outils de la discussion |
|
|
#1 |
|
Messages: n/a
Hébergeur: |
<?
$a="1+1"; //variables(string) //how can arithmetic variables(string) ?? //N ROW................ //output echo $a //i need output "2" not "1+1" //Please , Thank You Very Much !! ?> |
|
|
|
#2 |
|
Messages: n/a
Hébergeur: |
On 10/18/07, LKSunny <ad@pc86.com> wrote:
> > <? > $a="1+1"; //variables(string) > > //how can arithmetic variables(string) ?? > //N ROW................ > > //output > echo $a //i need output "2" not "1+1" > //Please , Thank You Very Much !! > ?> $a = 1+1; echo $a; -nathan |
|
|
|
#3 |
|
Messages: n/a
Hébergeur: |
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 , Thank You Very Much !! > ?> > You can do: eval("echo $a;"); But be warned, this has "Injection Attack" written all over it! Col |
|
|
|
#4 |
|
Messages: n/a
Hébergeur: |
Thank You !
"Colin Guthrie" <gmane@colin.guthr.ie> ¼¶¼g©ó¶l¥ó·s»D:ff76fg$ii3$1@ger.gmane.org... > 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 , Thank You Very Much !! >> ?> >> > > You can do: > > eval("echo $a;"); > > But be warned, this has "Injection Attack" written all over it! > > Col |
|
|
|
#5 |
|
Messages: n/a
Hébergeur: |
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 , 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 > |
|
|
|
#6 |
|
Messages: n/a
Hébergeur: |
On 10/18/07, Jochem Maas <jochem@iamjochem.com> 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 , 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 |
|
![]() |
| Outils de la discussion | |
|
|