You are here: Re: Butt ugly « PHP Programming Language « IT news, forums, messages
Re: Butt ugly

Posted by Jerry Stuckle on 05/27/06 15:02

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
?>


--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

 

Navigation:

[Reply to this 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

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