PHP alternative, lazy syntax

Alternative, lazy what?

Consider the next example:

';
     echo ''.$oItem->title.'';
     echo '';
} ?>

We could write the above like this:


     
  • title?>
  • Personally I think the second example is much easier to understand and a lot clearer for someone who isn’t familiar with PHP then the second one. (unfortunately my code highlight plugin thinks different though 😉 ) No braces in the code will also prevent some people to get the idea it’s to difficult to use PHP inside HTML and that integrating PHP into HTML is a task for PHP developers only. Also notice the advantage when indenting the HTML code.
    Futher it helps me to distinguish in my own projects template files and controllers, models,… because of the different syntax. So when I have a a file with mixed PHP and HTML this is the preferred way for me.

    Great! Let’s start using it!
    Good idea but bear in mind that their are a few drawbacks:

    • Not all servers allow the shorttags (check the short_open_tag entry in your php.ini file)
    • Not using ; in the above example is a bad practice and should be avoided
    • The most important one, their are other template engines on the market like Smarty, Dwoo, Savant, Template Blocks and a lot more that do the same thing but then easier or better (although you have minimal overhead)

    Futher I should note their are some heavy discussions (still?) going on in the PHP community whether the short tags are genius or just plain evil. One thing is pretty sure now the short tags will still be available in PHP version 6.

    For the complete list of the alternative syntax visit php.net

    Please fill in the poll and leave a comment.

    Comments

    1,133 responses to “PHP alternative, lazy syntax”

    1. https://gitea.wgqcd.com/ Avatar

      References:

      Anabolic steroids origin

      References:
      http://begild.top:8418/bonniemcallist

    2. www.canaddatv.com Avatar

      References:

      Best anabolic steroids for muscle mass

      References:
      http://81.69.221.216:3000/adriennecroft7

    3. www.kingspalace.net Avatar

      References:

      Where to order testosterone online

      References:
      https://www.zapztv.com/@damiandana803?page=about

    4. 119.23.72.7 Avatar

      References:

      Pro bodybuilders steroid cycles

      References:
      http://150.158.37.69:3000/gonzaloroldan

    5. git.mis24.ru Avatar

      References:

      Fast muscle growth pills

      References:
      http://14.103.185.243:3000/ceciliaerickso

    6. laviesound.com Avatar

      References:

      Anabolic stacks

      References:
      https://forgejo.3dcra.eu/dylanzhang6940

    7. git.archieri.fr Avatar

      References:

      Best steroid to gain mass

      References:
      http://180.163.77.12:3000/denicehansell9

    8. quickdatescript.com Avatar

      References:

      Cons of steroids in sports

      References:
      https://git.m.ctf.arrobe.fr/inescarmack010

    9. 106.55.174.214 Avatar

      References:

      Buying real steroids online

      References:
      https://inmessage.site/@graigswinford7

    10. music.drepic.com Avatar

      References:

      Dianabol and deca stack

      References:
      https://gitea.nacsity.cn/sharronwahl494

    11. gitlab.iplusus.com Avatar

      References:

      Bodybuilding cutting

      References:
      https://www.quranpak.site/ianpontiff4812

    12. https://git.clubeye.net/lorraineroddy Avatar

      References:

      Steroids for muscle growth and fat loss

      References:
      https://git.mis24.ru/geoffreybaumga

    13. moʻstbet Avatar

      Thank you for the good writeup. It in fact was a
      amusement account it. Look advanced to more added agreeable from
      you! However, how can we communicate?

    14. wedohandjobs Avatar

      I’m truly enjoying the design and layout of your site. It’s a very easy on the eyes which makes it much more enjoyable for me to come here and visit more often. Did you hire out a designer to create your theme? Superb work!

    Leave a Reply

    Your email address will not be published. Required fields are marked *