DekGenius.com
Home
(current)
Dictionary
BOOKS
LYRICS
CHORD
SCRIPT & CODE EXAMPLE
Karaoke language
Search
Go
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
COMMENT
Name
2+8 =
Submit