Ternary operators are shorter (which is good for writeability) than if there were else statements, however you really should use them only when working with one condition. Nested ternary operators really reduce readability.
In general, I only use ternary operators when:
1) I assign a condition based variable.
and
2) There is only one condition.
, .
:
$port = ($secure) ? 443 : 80;
a if else :
if($secure){
$port = 443;
} else {
$port = 80;
}
:
$port = 80;
if($secure){
$port = 443;
}
, ( , ).
, , , . , , , . , - . , .
, .
$count++
.
$count = $count + 1 // or $count += 1
, , , 9-10 $count++, .