Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    Regular Coder
    Join Date
    Jul 2005
    Posts
    216
    Thanks
    0
    Thanked 0 Times in 0 Posts

    starting a php script

    why is it some people use <? and others <?php ??

  • #2
    Regular Coder
    Join Date
    May 2006
    Location
    Canada
    Posts
    195
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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
    Last edited by RawliJr; 06-24-2006 at 10:06 PM.
    Rawli

  • #3
    Regular Coder
    Join Date
    Jul 2005
    Posts
    216
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by RawliJr
    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

    THanks for clearing that up

  • #4
    New Coder
    Join Date
    Apr 2006
    Location
    Tadley, UK
    Posts
    63
    Thanks
    5
    Thanked 0 Times in 0 Posts
    Wow, thanks for that info i didnt actually realize that, i just thought people use whatever tags they like.lol

  • #5
    New to the CF scene
    Join Date
    Jun 2006
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts
    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.

  • #6
    Senior Coder
    Join Date
    Sep 2005
    Posts
    1,791
    Thanks
    5
    Thanked 36 Times in 35 Posts
    It's probably worth adding that the asp-style tags are being deprecated for PHP-6


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •