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

    808 responses to “PHP alternative, lazy syntax”

    1. betterthanthemovieJeowN Avatar

      When the credits roll on your favorite film, pick up this book to keep the feeling alive. Lynn Painter captures the cinematic magic of romance and translates it into prose. A PDF copy ensures that you can dive into Liz and Wes’s world whenever the mood strikes. It is a story that validates your love for grand gestures while showing that the quiet moments are often the most meaningful. https://betterthanthemoviespdf.site/ Better Than The Movies Epub Download​

    2. wutheringheightspdJeowN Avatar

      Teachers often recommend digital texts to help students engage with classic literature. A Wuthering Heights PDF can make the dense Victorian prose more approachable. Many digital readers offer built-in dictionaries, which are invaluable for understanding the dialect and vocabulary used by Brontë. This removes barriers to comprehension and allows the reader to focus on the plot and themes. Whether it is the depiction of the harsh Yorkshire winter or the fiery temperaments of the characters, the digital version makes the text accessible to a new generation of learners. https://wutheringheightspdf.site/ Wuthering Heights Chapter 16 Pdf

    3. prideandprejudicepJeowN Avatar

      For students of the English language, this book is a goldmine. The vocabulary and sentence structure are exemplary. If you are learning English or studying literature, this text is essential. A Pride and Prejudice PDF is a practical study aid. Our website focuses on the educational value of the novel. We provide resources for those looking to master the language through the classics. Improve your English with the help of Jane Austen. https://prideandprejudicepdf.site/ Pride And Prejudice Free Epub

    4. eastofedenpdfJeowN Avatar

      The philosophical conversations between Adam Trask, Lee, and Samuel Hamilton are arguably some of the most important in 20th-century fiction. If you are preparing for a literature exam or a book club discussion, having access to the text is crucial for citing specific quotes. While holding a physical book has its charm, finding an East of Eden PDF or digital version can be incredibly useful for searching specific keywords and recurring motifs. We delve deep into the character of Cathy Ames and the concept of original sin, providing resources that complement your reading experience, regardless of the format you choose to explore this masterpiece. https://eastofedenpdf.site/ John Steinbeck East Of Eden Pdf

    5. betterthanthemovieJeowN Avatar

      Escape into a story where the lines between fiction and reality blur in the most romantic way. Liz’s journey to get the guy she thinks she wants leads her to the guy she actually needs. A Better Than the Movies PDF offers the convenience of reading this captivating tale on any device. It is a book that champions the idea that the best love stories are the ones that catch us completely by surprise. https://betterthanthemoviespdf.site/ Better Than The Movies Book Pdf​

    6. wutheringheightspdJeowN Avatar

      The sheer intensity of the emotions in this book makes it a standout in the Victorian canon. If you are ready to experience this whirlwind of feeling, search for a Wuthering Heights PDF. From the wild grief of Heathcliff digging up Catherine’s grave to the quiet hope of the ending, the novel covers the full spectrum of human experience. The digital format preserves every word of this emotional rollercoaster. It is a testament to the power of writing that a story from the 1800s can still evoke such strong reactions in readers today. https://wutheringheightspdf.site/ Wuthering Heights Novel Text Pdf

    7. Wuthering Heights Pdf Piano Avatar

      Revisiting a classic novel can offer new insights that were missed during a first reading. If it has been years since you read this book, consider downloading a Wuthering Heights PDF to refresh your memory. You might find that your perspective on Catherine’s choices or Heathcliff’s behavior has changed. The depth of the psychological analysis in the book is profound. A digital copy ensures that you can pick up the story exactly where you left off, making it easy to fit a chapter or two into a busy schedule while rediscovering the magic of the moors.

    8. Better Than The Movies Pdf Download Vk​ Avatar

      The evolution of the “enemies” label in this book is fascinating to watch. Liz and Wes have a banter that masks a deep underlying affection. If you are searching for a PDF version, you are on the path to a great read. It is a story that shows how thin the line between love and hate really is, and how wonderful it is to cross it.

    Leave a Reply

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