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

    1. qdate.ru Avatar

      References:

      Casino en linea

      References:
      https://www.peter-bartke.de/wpxsyreeta7233

    2. www.ttd.group Avatar

      References:

      Casino barriere lille

      References:
      https://git.flymiracle.com/celiamorrill97

    3. music.wzsipku.cn Avatar

      References:

      Souper spectacle montreal

      References:
      https://gitea.ontoast.uk/malissaibbott

    4. date-duell.de Avatar

      References:

      Politia de frontiera

      References:
      http://rm.runfox.com/gitlab/chante53c9097

    5. nastavniki.com Avatar

      References:

      Slot machine jackpots

      References:
      https://volts.howto.co.ug/@gretta40o24299

    6. eduback.com Avatar

      References:

      Slot games for android

      References:
      https://pod.tek.us/@oliviamattingl?page=about

    7. zm.aosenhw.com Avatar

      References:

      Casinos on line

      References:
      https://git.ultra.pub/leslindo458749

    8. dreamplacesai.de Avatar

      References:

      Monte casino cinema

      References:
      https://jom.gg/@christopher549

    9. www.shwemusic.com Avatar

      References:

      Poker no deposit bonus

      References:
      https://gitea.cfpoccitan.org/nicoleseeley1

    10. https://revenu.live/ Avatar

      References:

      Best online casino reviews

      References:
      https://k0ki-dev.com/romaineworrell

    11. gitlab.iplusus.com Avatar

      References:

      Goldstrike casino

      References:
      https://qpxy.cn/jadarayner9413

    12. git.automathon.org Avatar

      References:

      Mahjongg dimensions more time

      References:
      https://laviesound.com/kandacewgv5872

    13. traficut.com Avatar

      References:

      Microgaming casino bonus

      References:
      https://gitea.goldendeliverer.com/kareembuzacott

    14. wopid.io Avatar

      References:

      Slot machine casino

      References:
      https://gitiplay.com/@tonyaharding2?page=about

    15. code.dsconce.space Avatar

      References:

      Best online blackjack

      References:
      https://gt.clarifylife.net/isabelkiser94

    16. https://hiwifi.denq.us/ Avatar

      References:

      Casino torrequebrada

      References:
      https://gitea.ww3.tw/kathrinzeal622

    Leave a Reply

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