views:

358

answers:

2

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 involving question mark?

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

+3  A: 

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?

Crimson
not what i'm looking for. please look at the question again.
thephpdeveloper
+10  A: 

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+)?$
elviejo
not what i'm looking for. please look at the question again. thanks for being specific.
thephpdeveloper
@Mauris - that's all you're going to find: the question mark is only used there.
warren
@Mauris If I left an answer that was a solitary 'NO' would you find that helpful? elviejo's response was complete and appropriate.
Mike B