RE: [PHP] echo vs print
| From: | Maxim Maletsky | Date: | Fri, 09 Feb 2001 05:25:06 +0000 |
| Subject: | RE: [PHP] echo vs print | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-38898@lists.php.net to get a copy of this message | ||
If you search archives you'll find some blody battles on this kind of
issues,
there are some slight differences but work both well and are very similar in
performance - so this is the question of style. You see, Professional PHP
Programming was written by 5 young guys (including Sascha) and that is why
the yprobably coulnd't stick to one single style : couse they have some deep
preferences.
Anyway, "<?php" , "<?" are quite same too, except that php3 used to have
"<?php" while older versions use mainly "<?", this is just about
compatibility.
}; and } same things, it should be }; but the parser was then simplified to
understand } and so everyone uses this.
just like :
if($me && $you)
// is same as:
if($me and $you)
if($me || $you)
// is same as:
if($me or $you)
or like
$var = 1;
if($var) {
echo $var;
}
else {
echo 'Var is not set, sorry';
}
// is equal to
$var = 1;
echo $var ? $var : 'Var is not set, sorry';
It is generally all about your style,
Cheers,
Maxim Maletsky
-----Original Message-----
From: Todd Cary [mailto:todd@aristesoftware.com]
Sent: Friday, February 09, 2001 12:26 PM
To: php-general@lists.php.net
Subject: [PHP] echo vs print
I have "Profession PHP Programming" and I see that echo() and print()
are used alomst interchangeably. When should each one be used?
Also, I see "<?php" and "<?" used. Is there a preference?
And how about "};" versus "}" to end a block? I see both.
Todd
--
Todd Cary
Ariste Software
todd@aristesoftware.com
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
For additional commands, e-mail: php-general-help@lists.php.net
To contact the list administrators, e-mail: php-list-admin@lists.php.net