开发者

What does question mark in PHP represent other than Ternary Operator?

开发者 https://www.devze.com 2022-12-09 16:18 出处:网络
Is there any other use of the question mark ? in PHP other than being part as the Ternary Operator. Just to take note: I know about how it works in regex and all that. I am talking about the PHP lang

Is there any other use of the question mark ? in PHP other than being part as the Ternary Operator.

Just to take note: I know about how it works in regex and all that. I am talking about the PHP language itself, not regex or what. I know how it works in opening and closing tags.

I am more concerned about tokenizing a PHP script. Is there any other token invol开发者_如何学JAVAving question mark?

I've already checked the PHP manual by the way.


Well yeah in php it is used for:

  • <?php / ?> opening tags.
  • <? ?> short opening tags.
  • <?= $variable ?> equivalent to useful when working with templates.
  • ?: ternary operator
  • And is used in preg_match() when writing regular expressions. ^\s+(\s+)?$


For one, it is used to mark up the PHP code itself like this <? ?> :)

But seriously, are you driving at some particular use you wanted to understand?

0

精彩评论

暂无评论...
验证码 换一张
取 消