SitePoint Sponsor

User Tag List

View Poll Results: Do you use short tags

Voters
55. You may not vote on this poll
  • Yes

    10 18.18%
  • No

    45 81.82%
Page 3 of 3 FirstFirst 123
Results 51 to 56 of 56
  1. #51
    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)
    As for saving time, I don't really believe it saves THAT much time. Maybe about 1/4 second every time you use it at the speed most programmers type. I use <?php echo $var ?> without a problem sometimes, but mostly I echo the whole line out.

    Code:
    <input type="text" id="<?=$id?>" name="<?=$name?>" value="<?=$value?>" />
    Code:
    <input type="text" id="<?php echo $id ?>" name="<?php echo $name ?>" value="<?php echo $value ?>" />
    Code:
    <?php
    echo "<input type=\"text\" id="\" . $id . "\" name=\"" . $name . "\" value=\"" . $value . "\" />\r\n";
    ?>
    Call me strange, but I prefer the third way...

  2. #52
    ✯✯✯ silver trophybronze trophy php_daemon's Avatar
    Join Date
    Mar 2006
    Posts
    5,284
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by stereofrog View Post
    The short tags haters should realize that disabling this feature essentially kills php as a "templating language".
    The short tag haters do not use php as a "templating language". I don't.
    Saul

  3. #53
    ✯✯✯ silver trophybronze trophy php_daemon's Avatar
    Join Date
    Mar 2006
    Posts
    5,284
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Stormrider View Post
    As for saving time, I don't really believe it saves THAT much time. Maybe about 1/4 second every time you use it at the speed most programmers type. I use <?php echo $var ?> without a problem sometimes, but mostly I echo the whole line out.

    Code:
    <input type="text" id="<?=$id?>" name="<?=$name?>" value="<?=$value?>" />
    Code:
    <input type="text" id="<?php echo $id ?>" name="<?php echo $name ?>" value="<?php echo $value ?>" />
    Code:
    <?php
    echo "<input type=\"text\" id="\" . $id . "\" name=\"" . $name . "\" value=\"" . $value . "\" />\r\n";
    ?>
    Call me strange, but I prefer the third way...
    There's a fourth!

    Code php:
    echo<<<EOD
    <input type="text" id="$id" name="$name" value="$value" />
    EDO;
    Saul

  4. #54
    Theoretical Physics Student bronze trophy Jake Arkinstall's Avatar
    Join Date
    May 2006
    Location
    Lancaster University, UK
    Posts
    7,062
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    For some reason, EOD just doesn't feel right, maybe because I prefer using some kind of parenthesis/quote to enclose it.

    Anyway, I use the so far unmentioned fifth option, which is the path of printf(). In fact, I don't use PHP as a templating language at all.

    To be honest, I have never used
    PHP Code:
    <?=$var ?>
    because I don't think it's "propper" PHP.

    My only real argument for short tags is that it's got into a habit.
    Jake Arkinstall
    "Sometimes you don't need to reinvent the wheel;
    Sometimes its enough to make that wheel more rounded"-Molona

  5. #55
    SitePoint Addict
    Join Date
    Oct 2003
    Location
    United States
    Posts
    281
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Not all habit are good. Some are, and some aren't. Just because you do something habitually, it doesn't mean it is the best or safest way. You may habitually cross the street without looking both ways. You might get to the other side 9 out of 10 times, but one time you'll get hit.

    Short tags may be a way of coding, but you have a chance for something to break or go wrong because of it. Evidently there will be a consequence in the future. One day. Stop looking at ways to justify the way you code. If you get enough opinions from those who code the same way you do, you'll find the justification you need not to change. Change your habit. It isn't hard. If you don't, it may bite you in the butt.

  6. #56
    Theoretical Physics Student bronze trophy Jake Arkinstall's Avatar
    Join Date
    May 2006
    Location
    Lancaster University, UK
    Posts
    7,062
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    I know - that's what this thread is about.
    Jake Arkinstall
    "Sometimes you don't need to reinvent the wheel;
    Sometimes its enough to make that wheel more rounded"-Molona


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
  •