Friday 3 March 2017

Some cases where PHP short tags should be avoided

Most of the time when creating email template in PHP , we may need to separate some files and include these .
But including these files with shorthand cause some display problem .
<?=include('includes/header.php');?> 

Well, short tags are used for simple variable output and not a piece of HTML .
So we have to use like below .
<?php include('includes/header.php'); ?> 
Looking to build your career in Web Development .Visit us www.unitedwebsoft.in for complete advance Web Development , PHP course .We cover a complete e-commerce project based training that build your confidence to do any web project .We also started Laravel PHP MVC framework training
Short tags were, for a time, the standard in the PHP world; however, they do have the major drawback of conflicting with XML headers and, therefore, have somewhat fallen by the wayside .
In our experience most servers do have short tags enabled.
<?=
is far more convenient than typing
<?php echo 
From PHP 5.4.0 the short_open_tag mandate does exclude the short echo tag ! This is essential as the utilization of all other short echos is viewed as vain. In any case the utilization of the short echo tag is supported starting now and into the foreseeable future. It provides for a smoother and tidier code-base – esp. in view documents. So for PHP >= 5.4.0 can be utilized without setting short_open_tag. Kindly don’t utilize the other short tag in your code .
Original tutorial link : http://unitedwebsoft.in/blog/cases-php-short-tags-avoided/

No comments:

Post a Comment