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,187 responses to “PHP alternative, lazy syntax”

    1. http://81.70.24.14/ Avatar

      References:

      Anabolic steroids for back pain

      References:
      https://gitea.shizuka.icu/aleciabrumfiel

    2. git.scinalytics.com Avatar

      References:

      Credit can result in

      References:
      https://datemeonline.xyz/@natishabwv1108

    3. https://nas.zearon.com:2001/staceylundy61 Avatar

      References:

      Are steroids illegal for personal use

      References:
      https://dating.vi-lab.eu/@quintonheane50

    4. https://qpxy.cn Avatar

      References:

      Xtreme muscle pro reviews

      References:
      https://hbcustream.com/@alizatnh972869?page=about

    5. lcateam.com Avatar

      References:

      Types of steroids bodybuilding

      References:
      https://www.jo-line.eu/murielbranton

    6. gitea.jobiglo.com Avatar

      References:

      How much testosterone should i take to build muscle

      References:
      https://seychelleslove.com/@walkerchallis

    7. interior01.netpro.co.kr Avatar

      References:

      Health effects of anabolic steroids

      References:
      https://042.japan-entertainment.mhx.jp/@lewisbrenan233

    8. https://www.broutube.com/ Avatar

      References:

      When did bodybuilders start using steroids

      References:
      https://koonis.net/winifredher994

    9. git.meshel.cn Avatar

      References:

      Safest steroids to use for bodybuilding

      References:
      http://47.92.35.224:3000/jaimiesosa320

    10. ttym.space Avatar

      References:

      What are the effects of prolonged steroid use on the human body?

      References:
      https://giaovienvietnam.vn/employer/varicocele-and-its-effect-on-testosterone-implications-for-the-adolescent/

    11. itubee.com Avatar

      References:

      Anabolic steroid abuse

      References:
      https://mygit.kikyps.com/lashawnmarriot

    12. 115.159.194.75 Avatar

      References:

      Steroids before and after pics after one cycle

      References:
      https://arabsfans.com/@hildaorosco045

    Leave a Reply

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