RE: [PHP] '<?=' History / Info request
| From: | Lawrence dot Sheed at dfait-maeci dot gc dot ca | Date: | Fri, 17 Nov 2000 03:31:19 +0000 |
| Subject: | RE: [PHP] '<?=' History / Info request | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-25860@lists.php.net to get a copy of this message | ||
<? ?>
Is for short tags, you should use
<?php ?> to be totally compliant with all web servers.
="xxx"; essentially means echo
so
<?='history ...'?>
will echo history...
I think you're confusing two seperate things as one thing.
Use
<?php ?> for code start / end
use
='xxx';
or
echo 'xxx';
if you're feeling lazy
Personally I wouldn't use the ='xxx'; style, because its not as readable,
and not everyone knows it. If you work with other people, its good to make
code as readable as possible.
saving 4 keystrokes isn't really a saving in the long term.
Perl hackers may disagree here, but hey, I think some of my perl stuff looks
like line noise after i've written it!
-----Original Message-----
From: Philip Olson [mailto:philip@theprojects.org]
Sent: November 17, 2000 11:28 AM
To: php-general@lists.php.net
Subject: [PHP] '<?=' History / Info request
Hi! I do not use this <?= because I know not all accept its use but *who*
doesn't? Thus far I find some information but only through humans, no
docs :
Warning : Assumptions are just that, assumptions. Fairly certain they
are true but ... not 100% sure.
Assumptions :
-------------
A. PHP4 Specific.
B. If short_open_tag = 'off' in php.ini then this short cut is disabled
C. It acts as echo , not print
Questions :
-------------
A. What version did this come about exactly, 4.0.0 ?
B. What are some reasons one would disable short tags?
C. Is there a way to bypass a short tags setting so that it'll work,
like in an included config file? .htaccess is fine but ideally
a check like 'if short tags off then enable short tags.' although i
suppose this would defeat the purpose of 'off'. Hmm.
D. Could this "bypass" easily be done on php3 parsers as well? I assume
no way but will ask anyways as I am paranoid. Can think of ways to
'convert' but they involve work. Boo work.
Comments :
-------------
AFAIK this is not mentioned anywhere in the manual but of course should
be. I found reference to the ASP style shortcut of <%= but not this.
Also, <?= is not mentioned as a short tag in short tag settings. I
understand this is no doubt on the TODO list to document but I am curious
now! Would be nice if more time existed, bah, stupid time :-)
References :
-------------
Should be mentioned here as a short tag for echo , as well as in default
php.ini setting :
- http://www.php.net/manual/configuration.php#ini.short-open-tag
Briefly mentions <%= (ASP Style) but not <?= (PHP Style) but should :
- http://www.php.net/manual/language.basic-syntax.php
If a short cut for echo() it may as well be mentioned here too:
- http://www.php.net/manual/function.echo.php
Can't find mention in changelogs :
- PHP4 : http://php.net/ChangeLog-4.php
- PHP3 : http://php.net/ChangeLog.php3
Thank you, with this cleared up perhaps I, along with others, will use
this -- when applicable.
TIA,
Philip Olson
--
be outside the box.
--
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