Reply to Re: Butt ugly

Your name:

Reply:


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

"Jerry Stuckle" <jstucklex@attglobal.net> wrote in message
news:pbqdnZunEttRouXZRVn-gg@comcast.com...
> Rik G. wrote:
> > Coming from an Assembler/C/C++/C# background I got to say this is butt
ugly:
> >
> > <?php
> > echo "2 + 2 = " . 2+2; // This will print 4
> > echo "2 + 2 = " , 2+2; // This will print 2 + 2 = 4
> > echo "test " . 2+2; // This will print 2
> > ?>
> >
> > R.
> >
> >
>
> Not if you understand precedence. Remember, '.' has a high precedence.
The
> following all work:
>
>
> <?php
> echo "2 + 2 = " . (2+2); // This will print 2 + 2 = 4
> echo "2 + 2 = " , (2+2); // This will print 2 + 2 = 4
> echo "test " . (2+2); // This will print test 4
> ?>

OK, thanks, that looks better but still: why does it eat the strings "2 + 2
= " and "test " in case 1 and 3?

And here's for something even but uglier:

echo "2 + 2 = " . 2+3; // This will print 5
echo "2 + 2 = " , 2+3; // This will print 2 + 2 = 5
echo "test " . 2+3; // This will print 3

[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

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