I have used one if condition and i’m using opencart platform
code is working fine in my local but not in the server
<? if ($a == '1') : ?>
// if something
<? else: ?>
// else something
<? endif; ?>
this code giving me an error in my server
i’m using php version 7.2 in both my local and server
2
Answers
Make sure your code to be like this
short tags are deprecated. short tags depend on an INI directive and as such are non-portable.
If you enable short tags on server then you will not see error.
It is recommended to use if else statemens without short tags.
for more detail about short tags https://wiki.php.net/rfc/deprecate_php_short_tags