By ekalaivan


2009-12-26 17:47:52 8 Comments

What does this symbol mean in PHP <?=?

Example usage:

<h2>Manage Role: > (<?= $myACL->getRoleNameFromID($_GET['roleID']); ?>)</h2> 

4 comments

@Mike B 2009-12-26 17:51:12

To add to Mark's answer: The short_tags option must be enabled for the <?= syntax to be valid. This presents a major portability problem when moving to a server that has this option disabled.

See the PHP Manual for more info on short tags

@Doug Neiner 2009-12-26 17:52:35

Couldn't the user simply call ini_set('short_open_tag', 1) to override? Or if short tags are disabled, is the ini_set function normally disabled as well?

@gahooa 2009-12-26 17:57:10

@Doug: actually, by the time the user was allowed to call ini_set, the file was already parsed. So it's too late at that point. The best alternative is a directive in .htaccess or httpd.conf if you can.

@Doug Neiner 2009-12-26 18:06:49

Doh! Of course. Thanks for the response @gahooa!

@0b10011 2012-07-18 01:20:49

MikeB, the short_open_tag option no longer applies to <?= as of PHP 5.4.

@Reverend Gonzo 2009-12-26 17:50:58

The <?= ... > tag says to execute whatever is in ... and output the results.

@Sampson 2009-12-26 17:50:44

It's the PHP Short Tag equivalent of printing.

From the PHP INI:

Using short tags is discouraged when developing code meant for redistribution ; since short tags may not be supported on the target server.

See "Are PHP Short Tags Acceptable to Use?" on StackOverflow.

@Mark Biek 2009-12-26 17:49:27

It's functionally the same as <?php echo $myACL->getRoleNameFromID($_GET['roleID']); ?>

@Jakob Pogulis 2013-03-30 06:37:58

Although it is important to note that prior to PHP 5.4.0 the short echo syntax only works with the short_open_tag configuration setting enabled, which is off by default.

@Tushar Kulkarni 2015-05-27 08:00:41

Is there any execution performance difference between '<?php' & '<?='

Related Questions

Sponsored Content

18 Answered Questions

[SOLVED] Reference — What does this symbol mean in PHP?

10 Answered Questions

[SOLVED] How do you use bcrypt for hashing passwords in PHP?

37 Answered Questions

[SOLVED] Deleting an element from an array in PHP

  • 2008-12-15 20:28:55
  • Ben
  • 2438172 View
  • 2353 Score
  • 37 Answer
  • Tags:   php arrays unset

28 Answered Questions

[SOLVED] How do I get PHP errors to display?

34 Answered Questions

[SOLVED] Reference - What does this error mean in PHP?

7 Answered Questions

[SOLVED] How does PHP 'foreach' actually work?

16 Answered Questions

[SOLVED] Why shouldn't I use mysql_* functions in PHP?

  • 2012-10-12 13:18:39
  • Madara Uchiha
  • 211703 View
  • 2428 Score
  • 16 Answer
  • Tags:   php mysql database

28 Answered Questions

28 Answered Questions

[SOLVED] How can I prevent SQL injection in PHP?

4 Answered Questions

Sponsored Content