Question: I have this code:

```
<?php echo $form->fileField($model, 'avatar_url', array('style' => 'display:none')) ?>
<a href="#" class="thumbnail" style="width: 96px" id="avatar">
<?php if (empty($model->avatar_url)) { ?>
    <img data-src="holder.js/96x96" id="avatar-img">
<?php } else { ?>
    <img src="<?= Yii::app()->baseUrl . $model->avatar_url ?>" id="avatar-img">
<?php } ?>

```

When I replace `<?php` to `<?` , the code does not work and the browser shows an error.

> 
> PHP notice Undefined variable: class
> 
> 
> 

Maybe I missed an extension in PHP?

Answer: 
Sounds like you need to enable `short_open_tag` in your php.ini.
Find the line `short_open_tag` in your php.ini and set the value to `1`:

```
short_open_tag = 1

```

After you make the change, restart your web server.

Read more here: <http://php.net/manual/en/ini.core.php#ini.short-open-tag>

> 
> **short\_open\_tag**
> 
> 
> Tells PHP whether the short form (`<? ?>`) of PHP's open tag should be allowed. If you want to use PHP in combination with XML, you can disable this option in order to use `<?xml ?>` inline. Otherwise, you can print it with PHP, for example: `<?php echo '<?xml version="1.0"?>'; ?>`. Also, if disabled, you must use the long form of the PHP open tag (`<?php ?>`).
> 
> 
>
In PHP5 `<?` is not allowed any more. We always should use `<?php`. By the way you can do this doing some tricks. But `<?php` is a good practice so don't leave it.