2013-09-08 09:28
浏览 70

PHP代码中的<?= $ varname?>语法是什么? [重复]

This question already has an answer here:

Previous I bumped into codes like this:


It simply prints out the content of $var, so... is the syntax equivalent to echo $var? I'll also appreciate an answer pointing to a related manual page. Since the syntax is not searchable.


图片转代码服务由CSDN问答提供 功能建议

此问题已经存在 这里有一个答案:

  • 参考 - 这个符号在PHP中意味着什么? 18 answers \ n


     $ var =“hello”; 
    &lt;?= $ var?&gt; 

    它只是打印出$ var的内容,所以...是等同于 echo $ var 的语法? 我也很感激 回答指向相关的手册页。 由于语法不可搜索。

  • 写回答
  • 关注问题
  • 收藏
  • 邀请回答

1条回答 默认 最新

  • dongzhang6021 2013-09-08 09:29

    Yes, <?=$var?> is the same as <?php echo $var; ?>

    From PHP.net manual: echo also has a shortcut syntax, where you can immediately follow the opening tag with an equals sign. Prior to PHP 5.4.0, this short syntax only works with the short_open_tag configuration setting enabled.

    You can read more here.

    打赏 评论

相关推荐 更多相似问题