CKTIS / PHP
is_int()
Verifica che un indice abbia davvero tipo int.
Versione: PHP 8.4; repository runtime, production runtime not attested
Sintassi
is_int(mixed $value): boolVerifica che un indice abbia davvero tipo int. Un valore float senza parte frazionaria e una stringa numerica danno false. Zero e gli interi negativi superano il test, quindi il limite inferiore va controllato a parte.
Firma
is_int(mixed $value): bool
Output dell’esempio
[true,true,false,false,false]
Esempi
<?php
echo json_encode(array_map("is_int", [0, -1, 2.0, "2", false]));
Risultato
[true,true,false,false,false]