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