CKTIS / PHP
is_string()
Riconosce una stringa anche se è vuota, binaria o fatta solo di cifre.
Versione: PHP 8.4; repository runtime, production runtime not attested
Sintassi
is_string(mixed $value): boolRiconosce una stringa anche se è vuota, binaria o fatta solo di cifre. Un oggetto con __toString dà false. Il controllo precede un’operazione che si aspetta byte già memorizzati.
Firma
is_string(mixed $value): bool
Output dell’esempio
[true,true,true,false,false]
Esempi
<?php
class Label { public function __toString(): string { return "12"; } }
echo json_encode(array_map("is_string", ["", "\0", "12", 12, new Label()]));
Risultato
[true,true,true,false,false]