1. Home
  2. Php
  3. Ternary operator

Ternary operator evaluates first parameter followed by two values. First value is returned when the condition is true otherwise the second value is returned.

#php#conditional
// Condition ? True : False

$hour = 14;
($hour <= 12) ? "Morning" : "Afternoon";
copy
Full Php cheatsheet