I'm receiving the following error:
Parse error: syntax error, unexpected '}', expecting end of file in /blah/blah/Edit.php on LINE_WITH_COMMENT
for this code inside my Edit.php
view file.
<? $categories = $this->config->loader->getCategories();
foreach($categories as $category) { ?>
<? $selected = $this->obj->category==$category ? 'selected' : ''; ?>
<option value="<?=$category?>" <?=$selected?>><?=$category?></option>
<?php } ?> //ERROR IS HERE
But if I change <?php
to the short open tag <?
, the error goes away, and my script works as expected.
It works on my server with hostgator with <?php
but on my local machine it's only working with <?
and giving the fatal error if I have <?php
.
From phpinfo()
on the local machine: PHP Version 7.2.17-0ubuntu0.19.04.1
I've changed <?php
to <?
for now, but how can I fix this? I prefer not to use short open tags.