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

    856 responses to “PHP alternative, lazy syntax”

    1. output.jsbin.com Avatar

      References:

      Best steroid for weight gain

      References:
      output.jsbin.com

    2. community.srhtech.net Avatar

      References:

      Steroids to get ripped for sale

      References:
      community.srhtech.net

    3. tombofannihilationJeowN Avatar

      One of the biggest challenges in this campaign is the “ticking clock” element of the Death Curse. Every day matters, and the players feel the pressure. The book provides a timeline and consequences for the passage of time. Consulting the Tomb of Annihilation PDF helps the DM track the degradation of NPC health and the advancement of the villain’s plot. This structural urgency is what makes the campaign so compelling. With a digital guide, you can easily cross-reference the travel times between hexes to ensure the timeline remains consistent and the threat of the curse remains an ever-present shadow over the party’s actions. https://tombofannihilationpdf.store/ Tomb Of Annihilation Dnd 5E Pdf

    4. animalfarmpdfJeowN Avatar

      By the end of the book, the Seven Commandments have been reduced to one. This reductionism is the hallmark of totalitarian rule. It simplifies life to serve the rulers. See the final commandment in the Animal Farm PDF. It is the most famous line in the book for a reason. https://animalfarmpdf.store/ Pdf Animal Farm Test

    5. theawakeningpdfJeowN Avatar

      “She was becoming herself and daily casting aside that fictitious self which we assume like a garment with which to appear before the world.” This is the essence of the book. To find your own true self, read the awakening pdf. It is a guide to stripping away the inessential. The digital text is a mirror for the soul. https://theawakeningpdf.store/ The Awakening Dover Thrift Edition Pdf

    6. tomsawyerpdfJeowN Avatar

      The Adventures of Tom Sawyer is a cornerstone of American literature. Mark Twain’s writing is as relevant today as it was when the book was first published. We offer a high-quality digital version for modern readers. Whether you are studying the text or just reading for fun, our resource is invaluable. Download the Tom Sawyer PDF and enjoy the convenience of having this literary classic on your personal device. https://tomsawyerpdf.store/ Tom Sawyer Full Text Pdf

    Leave a Reply

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