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> 


@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.

@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

38 Answered Questions

[SOLVED] Deleting an element from an array in PHP

  • 2008-12-15 20:28:55
  • Ben
  • 2666431 View
  • 2543 Score
  • 38 Answer
  • Tags:   php arrays unset

20 Answered Questions

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

4 Answered Questions

28 Answered Questions

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

36 Answered Questions

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

30 Answered Questions

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

10 Answered Questions

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

13 Answered Questions

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

  • 2012-10-12 13:18:39
  • Madara's Ghost
  • 222640 View
  • 2512 Score
  • 13 Answer
  • Tags:   php mysql

7 Answered Questions

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

Sponsored Content