CKTIS / PHP
boolval()
Converte un valore in bool per combinare più indicatori.
Versione: PHP 8.4; repository runtime, production runtime not attested
Sintassi
boolval(mixed $value): boolConverte un valore in bool per combinare più indicatori. Le stringhe "" e "0" danno false, mentre "false" e "00" danno true. Un array che contiene soltanto false è già vero.
Firma
boolval(mixed $value): bool
Output dell’esempio
[false,false,true,true,false,true]
Esempi
<?php
echo json_encode(array_map("boolval", ["", "0", "false", "00", [], [false]]));
Risultato
[false,false,true,true,false,true]