PHP alternative, lazy syntax
Alternative, lazy what?
Consider the next example:
';
echo ''.$oItem->title.'';
echo '';
} ?>
We could write the above like this:
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.
https://t.me/s/Official_1xbet_1xbet/1852
Josephadvem
17 Oct 25 at 10:09 am
buy Doxycycline: order medicine discreetly USA – online pharmacy
AndrewPal
17 Oct 25 at 10:09 am
https://t.me/s/Official_1xbet_1xbet/1640
Josephadvem
17 Oct 25 at 10:35 am
https://t.me/s/Official_1xbet_1xbet/1625
Josephadvem
17 Oct 25 at 10:39 am
https://t.me/s/Official_1xbet_1xbet/1645
Josephadvem
17 Oct 25 at 11:03 am
https://t.me/Official_1xbet_1xbet/1691
Josephadvem
17 Oct 25 at 11:07 am
https://t.me/s/Official_1xbet_1xbet/1799
Josephadvem
17 Oct 25 at 11:34 am
https://t.me/s/Official_1xbet_1xbet/1846
Josephadvem
17 Oct 25 at 11:38 am
https://t.me/s/Official_1xbet_1xbet/1845
Josephadvem
17 Oct 25 at 12:03 pm
https://t.me/Official_1xbet_1xbet/1735
Josephadvem
17 Oct 25 at 12:07 pm
https://t.me/s/Official_1xbet_1xbet/1795
Josephadvem
17 Oct 25 at 12:33 pm
https://t.me/s/Official_1xbet_1xbet/1672
Josephadvem
17 Oct 25 at 12:36 pm
https://t.me/s/Official_1xbet_1xbet/1760
Josephadvem
17 Oct 25 at 1:01 pm
https://t.me/s/Official_1xbet_1xbet/1738
Josephadvem
17 Oct 25 at 1:05 pm
https://t.me/Official_1xbet_1xbet/1658
Josephadvem
17 Oct 25 at 1:31 pm
https://t.me/Official_1xbet_1xbet/1636
Josephadvem
17 Oct 25 at 1:35 pm
https://t.me/Official_1xbet_1xbet/1792
Josephadvem
17 Oct 25 at 2:02 pm
https://t.me/s/Official_1xbet_1xbet/1830
Josephadvem
17 Oct 25 at 2:05 pm
https://t.me/Official_1xbet_1xbet/1646
Josephadvem
17 Oct 25 at 2:31 pm
https://t.me/Official_1xbet_1xbet/1730
Josephadvem
17 Oct 25 at 2:35 pm
https://t.me/Official_1xbet_1xbet/1600
Josephadvem
17 Oct 25 at 3:01 pm
https://t.me/s/Official_1xbet_1xbet/1714
Josephadvem
17 Oct 25 at 3:05 pm
https://t.me/s/Official_1xbet_1xbet/1715
Josephadvem
17 Oct 25 at 3:32 pm
https://t.me/s/Official_1xbet_1xbet/1749
Josephadvem
17 Oct 25 at 3:36 pm
https://t.me/Official_1xbet_1xbet/1847
Josephadvem
17 Oct 25 at 4:01 pm
https://t.me/s/Official_1xbet_1xbet/1702
Josephadvem
17 Oct 25 at 4:05 pm
https://t.me/Official_1xbet_1xbet/1784
Josephadvem
17 Oct 25 at 4:31 pm
https://t.me/s/Official_1xbet_1xbet/1608
Josephadvem
17 Oct 25 at 4:35 pm
https://t.me/Official_1xbet_1xbet/1834
Josephadvem
17 Oct 25 at 5:01 pm
https://t.me/s/Official_1xbet_1xbet/1731
Josephadvem
17 Oct 25 at 5:04 pm
https://t.me/Official_1xbet_1xbet/1623
Josephadvem
17 Oct 25 at 5:30 pm
https://t.me/Official_1xbet_1xbet/1680
Josephadvem
17 Oct 25 at 5:34 pm
https://t.me/s/Official_1xbet_1xbet/1793
Josephadvem
17 Oct 25 at 5:59 pm
https://t.me/s/Official_1xbet_1xbet/1677
Josephadvem
17 Oct 25 at 6:28 pm
https://t.me/Official_1xbet_1xbet/1813
Josephadvem
17 Oct 25 at 6:32 pm
https://t.me/Official_1xbet_1xbet/1745
Josephadvem
17 Oct 25 at 7:00 pm
https://t.me/Official_1xbet_1xbet/1856
Josephadvem
17 Oct 25 at 7:04 pm
https://t.me/Official_1xbet_1xbet/1677
Josephadvem
17 Oct 25 at 7:31 pm
https://t.me/Official_1xbet_1xbet/1687
Josephadvem
17 Oct 25 at 7:35 pm
https://t.me/s/Official_1xbet_1xbet/1664
Josephadvem
17 Oct 25 at 8:02 pm
https://t.me/Official_1xbet_1xbet/1708
Josephadvem
17 Oct 25 at 8:06 pm
https://t.me/s/Official_1xbet_1xbet/1751
Josephadvem
17 Oct 25 at 8:32 pm
https://t.me/s/Official_1xbet_1xbet/1784
Josephadvem
17 Oct 25 at 8:35 pm
https://t.me/Official_1xbet_1xbet/1633
Josephadvem
17 Oct 25 at 9:01 pm
https://t.me/Official_1xbet_1xbet/1756
Josephadvem
17 Oct 25 at 9:04 pm
https://t.me/s/Official_1xbet_1xbet/1847
Josephadvem
17 Oct 25 at 9:30 pm
https://t.me/Official_1xbet_1xbet/1771
Josephadvem
17 Oct 25 at 9:34 pm
https://t.me/Official_1xbet_1xbet/1715
Josephadvem
17 Oct 25 at 9:59 pm
https://t.me/s/Official_1xbet_1xbet/1814
Josephadvem
17 Oct 25 at 10:03 pm
https://t.me/s/Official_1xbet_1xbet/1629
Josephadvem
17 Oct 25 at 10:29 pm