SitePoint Sponsor

User Tag List

Results 1 to 11 of 11

Thread: <?=$msg_5048?>

  1. #1
    SitePoint Guru
    Join Date
    Sep 2008
    Location
    Dubai
    Posts
    971
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    <?=$msg_5048?>

    Hi,

    Can you explain that for me ?

  2. #2
    SitePoint Addict fattyjules's Avatar
    Join Date
    Dec 2005
    Posts
    295
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It's shorthand for;

    PHP Code:
    <?php echo $msg_5048?>

  3. #3
    SitePoint Guru
    Join Date
    Sep 2008
    Location
    Dubai
    Posts
    971
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    thanks mate

  4. #4
    SitePoint Member
    Join Date
    Nov 2008
    Posts
    11
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Thats the other syntax for the term "echo"

  5. #5
    SitePoint Wizard silver trophybronze trophy Stormrider's Avatar
    Join Date
    Sep 2006
    Location
    Nottingham, UK
    Posts
    3,133
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Short tags are not recommended for use though, use the 'longhand' version when you code:

    PHP Code:
    <?php echo $msg_5048?>

  6. #6
    SitePoint Guru
    Join Date
    Sep 2008
    Location
    Dubai
    Posts
    971
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Stormrider View Post
    Short tags are not recommended for use though, use the 'longhand' version when you code:

    PHP Code:
    <?php echo $msg_5048?>
    why?

  7. #7
    SitePoint Wizard silver trophybronze trophy Stormrider's Avatar
    Join Date
    Sep 2006
    Location
    Nottingham, UK
    Posts
    3,133
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Some servers have the option turned off, so it decreases your application's portability, and can be a potential security issue if you tried to use it with the short tags option turned off.

    A lot of servers turn it off because the '<?' without the 'php' afterwards can get confused with the XML document 'prolog', which also starts '<?'.

  8. #8
    SitePoint Addict fattyjules's Avatar
    Join Date
    Dec 2005
    Posts
    295
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    I find short tags fantastically useful for templates, e.g.;

    PHP Code:
    <h2>My shoes</h2>

    <? foreach($visitor->shoes AS $shoe): ?>

    <p><?= $shoe ?></p>

    <? endforeach; ?>
    But in 'normal' PHP, I use the full <?php ... ?> tags.

  9. #9
    SitePoint Wizard silver trophybronze trophy Stormrider's Avatar
    Join Date
    Sep 2006
    Location
    Nottingham, UK
    Posts
    3,133
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Yes, and that is what they were originally designed for, but you have to be careful because it won't work on all servers.

  10. #10
    SitePoint Zealot
    Join Date
    Oct 2008
    Posts
    155
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Stormrider View Post
    Some servers have the option turned off, so it decreases your application's portability, and can be a potential security issue if you tried to use it with the short tags option turned off.

    A lot of servers turn it off because the '<?' without the 'php' afterwards can get confused with the XML document 'prolog', which also starts '<?'.

    Ah, I have always wondered why admins would turn it off. Thanks!

  11. #11
    SitePoint Wizard silver trophybronze trophy Stormrider's Avatar
    Join Date
    Sep 2006
    Location
    Nottingham, UK
    Posts
    3,133
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Another reason I have literally just discovered.. running php from the command line appears to be ignoring the short tags setting in the ini file, and outputting all the files that use short tags (not my site, I didn't put them there!)


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
  •