php - understanding nested ternary operators -
i have piece of code unclear me, complex use of ternary operators
if (!$byfield && is_numeric($v)){ // id $r=$fromrow? $fromrow: ($v? dbrow("select * pages id=$v limit 1"): array() ); }
if explain how evaluate nested use of ternary operators
consider following code:
<?php $a = true; $b = false; $c = true; echo ( $a ? 'a true' : ( $b ? 'a false, b true' : ( $c ? 'a false, b false, c true' : 'a, b , c false' ) ) ); ?>
which rewritten so:
<?php if ($a) { echo 'a true'; } else { if ($b) { echo 'a false, b true'; } else { if ($c) { echo 'a false, b false c true'; } else { echo 'a, b , c false'; } } } ?>
Comments
Post a Comment