...

View Full Version : starting a php script



jeromepelletier
06-24-2006, 09:48 PM
why is it some people use <? and others <?php ??

RawliJr
06-24-2006, 09:55 PM
Its not always the programer...it is usally is the server that supports different sings.


it is better to use <?php ?> then <? ?>

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 . . ." %>

from php.net (http://www.php.net)

jeromepelletier
06-25-2006, 02:57 AM
Its not always the programer...it is usally is the server that supports different sings.


it is better to use <?php ?> then <? ?>

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 . . ." %>

from php.net (http://www.php.net)


THanks for clearing that up :D

Webmonkey
06-25-2006, 08:55 AM
Wow, thanks for that info i didnt actually realize that, i just thought people use whatever tags they like.lol

Maine
06-25-2006, 09:33 AM
I am new to php just learning but I THINK if you wanna use the short tag "<?" you have to make sure this short_open_tag = Off is set to on in the php.ini file.

GJay
06-25-2006, 10:24 AM
It's probably worth adding that the asp-style tags are being deprecated for PHP-6



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum