SitePoint Sponsor

User Tag List

Results 1 to 4 of 4
  1. #1
    SitePoint Guru mdumka's Avatar
    Join Date
    Jul 2003
    Location
    True North
    Posts
    642
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question New to PHP ... Best Practice for PHP tags

    Hello ...

    I am very new to PHP and was wondering which is the best way to set my PHP tags?

    Code:
    <?php //code ?>
    or ...

    Code:
    <? //code ?>
    Dreamweaver lets me do both ...

    Much thanks

    Mike

  2. #2
    SitePoint Zealot
    Join Date
    Jan 2011
    Location
    Portland
    Posts
    148
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    best practice is use the full php tag "<?php ?>" the other is a shortcut and is not the most supported habit to have. But does work well with HTML and templating.
    coming soon sitejuju.com my new development portfolio

  3. #3
    SitePoint Guru mdumka's Avatar
    Join Date
    Jul 2003
    Location
    True North
    Posts
    642
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thanks Buddy ... that is what I thought, but just wanted to make sure.

    But I have to ask how to you know when to use a 'shortcut'?

  4. #4
    SitePoint Zealot
    Join Date
    Jan 2011
    Location
    Portland
    Posts
    148
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    That really is completely up to you. I tend to try and base it off if it will help me more quickly, Is it easier to understand, Is it easier to write, Is it considered in good practice.
    coming soon sitejuju.com my new development portfolio


Bookmarks

Posting Permissions

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