I am having issue with PHP’s ternary operator, since PHP version 5.3 you are able to replace the shorthand ternary operator with an even shorter version
// Older version
$route = isset($test) ? $test : 'test is NOT set';
// Newer version as of 5.3
$route = isset($test) ?: 'test is NOT set';
Now on the newer version, if $test is not set. it works fine. However when it is set because of the isset() method, it is returning true or 1 instead of the value.
Do I have to use the older longer method to get $route to equal the value of $test instead of a boolean value of 1 ?
You have to use the longer version.
Quoting the docs:
So the correct behaviour for your shorthand version is to return the result of evaluating
isset($test). Not of$testas you want.