What difference is there between using the ?:
conditional operator and the ||
Logical OR
.
I am finding that my code works with:
$screenpixelratio = !empty($_COOKIE['screenpixelratio']) || $_COOKIE['screenpixelratio'] || $fallback_pixelratio;
But not:
$screenpixelratio = !empty($_COOKIE['screenpixelratio']) ? $_COOKIE['screenpixelratio'] : $fallback_pixelratio;
Could someone please explain why it would work with one, but not the other.
$screenpixelration
.?:
is a ternary operator, not the ternary operator (ternary operator is a category of operators). It's specific name is the conditional operator. en.wikipedia.org/wiki/Ternary_operator is the category. Look under "See also" on that page for the conditional operator (the link doesn't work because of the:
in the URL).