Search snippets
Browse Code Answers
FAQ
Usage docs
Log In
Sign Up
Home
PHP
ternary operator for three conditions in php
thunderblaster
Programming language:
PHP
2021-05-18 18:38:40
0
Q:
ternary operator for three conditions in php
Max
Code:
PHP
2021-07-08 17:00:19
$foo = your_value; $bar = ($foo == 1) ? "1" : (($foo == 2) ? "2" : "other"); echo $bar;
0
Tags
php
con
Related
ternary in php
multiple orwhere condition in laravel
check if number is multiple of 3 in php
laravel where multiple conditions
php ternary operator
multiple logical condition in laravel query
php conditionals
is number divisible by 3 php
laravel where multiple conditions on single colmn
php function return multiple values
in array php multiple values
How do i multiple variables in php
if else if ternary php
ternary operator in php
php foreach multiple variables
ternary operator php
New to Communities?
Join the community