Converting some values to boolean is a common task while building applications. Let’s say Yes/No or On/Off.
Now, if you want to convert any of these pairs to a boolean, you might end up using conditionals.
Here are all the values that filter_var can effectively convert to their boolean counterpart. value boolean ‘on’ bool(true) ‘On’ bool(true) bool(true) ‘off’ bool(false) ‘Off’ bool(false) bool(false) ‘yes’ bool(true) ‘Yes’ bool(true) bool(true) ‘no’ bool(false) ‘No’ bool(false) bool(false) bool(false) 1 bool(true) ‘0’ bool(false) ‘1’ bool(true) ‘true’ bool(true) ‘True’ bool(true) bool(true) ‘false’ bool(false) ‘False’ bool(false) bool(false) true bool(true) false bool(false) ‘foo’ ‘bar’ NULL