Reply to Re: Butt ugly

Your name:

Reply:


Posted by Rik G. on 05/27/06 15:39

"Rik" <luiheidsgoeroe@hotmail.com> wrote in message
news:de52b$447846ce$8259c69c$22611@news1.tudelft.nl...

[Snip]

> Not only precedence, type juggling also plays a major part here.
> Detailed:
>
> >> echo "2 + 2 = " . 2+2; // This will print 4
>
> 1. The string "2 + 2 = " becomes "2 + 2 = 2" (indeed precedence).
> 2. Trying to add a number to this string casts it to 2 (the first number),
> and adds 2, so gives 4.
>
> >> echo "2 + 2 = " , 2+2; // This will print 2 + 2 = 4
>
> The string "2 + 2 = " gets echoed seperately from the integer resulting
from
> adding 2+2
>
> >> echo "test " . 2+2; // This will print 2
>
> 1. The string "test " becomes "test 2".
> 2. Trying to add the number 2 to "test 2" casts the string to an integer
> (0), and adding 2 gives indeed 2
>
> Variable variables, without strict type, are a blessing in some cases, in
> others it's immensely irritating. You just have to keep an eye on it :-).

OK, it's clear now (but still butt ugly).
Thanks for the explanation.

R.

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация