What is the problem with =$expression ?> ?
-
It requires short tags and this is not compatible with XML
-
There is no problem
-
This syntax doesn't even exist It requires a special PHP library that may not always be available
The short echo syntax =$expression ?> requires short_open_tag to be enabled in php.ini. This conflicts with XML declarations which also start with . Since PHP 5.4, short echo tags are always available regardless of short_open_tag setting, but full short tags ?> still conflict with XML and are discouraged for portable code.
The short echo tag = $expression ?> is a shorthand form of `, and it only works when theshort_open_tagsetting is enabled on the server — it's not guaranteed to be available everywhere. Historically this shorthand also conflicted with XML processing instructions, since...?>` is the same syntax XML uses for its own processing instructions, causing parser confusion in XML-embedded contexts. That's why relying on it is considered a portability/compatibility problem rather than a safe default.