Answers for "ternary operator for three conditions in php"

PHP
0

ternary operator for three conditions in php

$foo = your_value;
$bar = ($foo == 1) ? "1" : (($foo == 2)  ? "2" : "other");
echo $bar;
Posted by: Guest on July-13-2020

Code answers related to "ternary operator for three conditions in php"

Browse Popular Code Answers by Language