CKTIS / PHP
PHP type bool
A boolean stores true or false.
Version: PHP 8.4; repository runtime, production runtime not attested
Syntax
bool $enabledA boolean stores true or false. In conditions PHP converts other values to boolean: zero, null, an empty array, the empty string and the exact string "0" are false-like. The text "false" is nonempty and true-like. Parse configuration text explicitly when the word false should disable a setting.
$inputs = [false, 0, '0', '', 'false', '00', []];
echo json_encode(array_map(fn($v): bool => (bool)$v, $inputs));
[false,false,false,false,true,true,false]
Examples
<?php
$inputs = [false, 0, '0', '', 'false', '00', []];
echo json_encode(array_map(fn($v): bool => (bool)$v, $inputs));
Result
[false,false,false,false,true,true,false]