Jump to content

what is '<?='


samona

Recommended Posts

I can't remember what it is exactly called in the php.ini file but basically <?= is the same as <?php echo

 

The option has to be turned on if you php.ini file to be able to use it.

 

ex. <?=$varable?> is much shorter than doing <?php echo $variable; ?>

Link to comment
Share on other sites

<? ?> and <?= ?> are called short tags. These can only be used if the setting called short_open_tag is enabled. However it is not recommended to use these tags as not all PHP configurations have this setting enabled. You're better of of using the full PHP tag syntax <?php ?> and  <?php echo ?>

Link to comment
Share on other sites

Although I don't disagree with wildteen88 in terms of the basic consensus, I don't seem much of a problem with using short tags, if you can control the server environment.  Sometimes these issues have a way of being pushed by the people who write projects used by the masses, when there is more people writing php for sites or businesses where there is no concern about control of the php.ini file, or being able to enable short tags.  Up until version 5.3 the default was to have short tags set to on.

 

I don't have a problem with short tags, especially when used in templates.  For example, there's no doubt that template writers will prefer:

 

= $pageheader ?>

 

Rather than the tedium of

 


 

 

 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.