-1

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 Answers2

0

Make sure your code to be like this

<?php if ($a == '1') : ?>
// if something
<?php else: ?>
// else something
<?php endif; ?>
Manikanta
  • 193
  • 3
  • 17
0

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

Umar Abdullah
  • 1,282
  • 1
  • 19
  • 37