PHP Shorthand Ternary not behaving as expected -
introduced in php 5.3, shorthand ternary operator should work this:
$result = 'foo' ?: 'bar'; should return foo. however, on live server (php 5.4.26), result bar.
a full ternary operator syntax works fine.
$test = 'foo'; $result = $test ? $test : 'bar'; returns foo correctly. both syntaxes fine on dev server (php 5.3.10).
is there way disabled somehow? suggestions?
changing instances full systax undesirable - there's significant number in external library (amazon aws sdk).
correction:
$result = 'foo' ?: 'bar'; does have correct result on both servers, but
$test = 'foo'; $result = $test ?: 'bar'; incorrectly returns bar on live server. wierder...
Comments
Post a Comment