Answers for "php single line if/else"

PHP
5

write if and else in one line php

$result = ($data->status == 1) ? 'active' : 'disable'
Posted by: Guest on November-08-2020
0

php one line if without else

$thisVar != $thatVar ?: doThis();
or
($thisVar == $thatVar) && doThis();
or
if ($thisVar == $thatVar) doThis();
Posted by: Guest on May-01-2021

Code answers related to "php single line if/else"

Browse Popular Code Answers by Language