Vidyalelo
PHP · Q27

Basic PHP

Programming · PHP · question 27

Q27

If a = 12 what will be returned when ( a == 12) ? 5 : 1 is executed?

A.
12
B.
1
C.
Error
D.
5
Answer

Answer: Option D

Solution

Answer: Option D
Solution:
?: is known as ternary operator. If condition is true then the part just after the ? is executed else the part after : .