The rest of the answers seem to worry only about converting a boolean to an integer. I think you really want the second value to be the result if the first is false ( 0 , false , etc.)?
For the behavior of other languages, the shortest ternary operator: 0?:1 is closest to PHP.
This can be used in a script like: $result = get_something() ?: 'a default';
See the ternary operator documentation for more information.
source share