|
Posted by Rami Elomaa on 05/28/07 15:38
Michael kirjoitti:
> I'm new to PHP.
>
> Evidently my ISP's server does not recognize <?php ... ?>, but it does
> recognize <script language="php"> ... </script>, which would imply
> that <?php ... ?> is not portable.
>
> If in fact <?php ... ?> is not portable, why are so many PHP scripts
> using it?
>
From php.net:
******************
Example 10.2. PHP Opening and Closing Tags
1. <?php echo 'if you want to serve XHTML or XML documents, do like
this'; ?>
2. <script language="php">
echo 'some editors (like FrontPage) don\'t
like processing instructions';
</script>
3. <? echo 'this is the simplest, an SGML processing instruction'; ?>
<?= expression ?> This is a shortcut for "<? echo expression ?>"
4. <% echo 'You may optionally use ASP-style tags'; %>
<%= $variable; # This is a shortcut for "<% echo . . ." %>
While the tags seen in examples one and two are both always available,
example one is the most commonly used, and recommended, of the two.
******************
From http://www.php.net/manual/en/language.basic-syntax.php
I must say the server configuration at you ISP is something quite odd,
since it distinctly says above that <?php ?> is _always_ available.
Short open tags and asp-style tags are configurable. But to answer your
question: so many scripts use <?php ?> simply because it is officially
recommended.
You might want to check with your ISP to see what the fuck have they
done to break such a fundamental issue and why have they've chosen to do so.
--
Rami.Elomaa@gmail.com
"Wikipedia on vähän niinq internetin raamattu, kukaan ei pohjimmiltaan
usko siihen ja kukaan ei tiedä mikä pitää paikkansa." -- z00ze
[Back to original message]
|