Firstly is there a name for this expression ?
Javascript
var value = false || 0 || '' || !1 || 'string' || 'wont get this far';
value equals string (string) aka the fifth option
PHP
$value = false || 0 || '' || !1 || 'string' || 'wont get this far';
$value equals true (bool)
Am I right in thinking the correct way to achieve the same result as JavaScript is by nesting ternary operators? What is the best solution ?
trueonly..Testecho true;<?php $value = false || 0 || '' || true || 'wont get this far'; echo $value===true?'true':$value; ?>