Search
 
SCRIPT & CODE EXAMPLE
 
CODE EXAMPLE FOR PHP

ternary operator for three conditions in php

$foo = your_value;
$bar = ($foo == 1) ? "1" : (($foo == 2)  ? "2" : "other");
echo $bar;
Source by stackoverflow.com #
 
PREVIOUS NEXT
Tagged: #ternary #operator #conditions #php
ADD COMMENT
Topic
Name
9+8 =