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:[EMAIL PROTECTED]]
Sent: Friday, February 09, 2001 12:26 PM
To: [EMAIL PROTECTED]
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
[EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]