gettype

(PHP 3, PHP 4 )

gettype -- Resituisce il tipo di una variabile

Descrizione

string gettype ( mixed var)

Restituisce il tipo della variabile PHP var.

Attenzione

Non utilizzare gettype() per testare certi tipi di variabili poichè la stringa restistuita potrebbe variare nelle versioni future. Inoltre questa funzione è lenta dato che richiede confronti tra stringhe .

Piuttosto utilizzare le funzioni is_*.

La stringa restituita può assumere i seguenti valori:

Nella versione 4 di PHP si dovrebbe applicare alle funzioni function_exists() o method_exists() al posto del precedente gettype().

Vedere anche settype(), is_array(), is_bool(), is_float(), is_integer(), is_null(), is_numeric(), is_object(), is_resource(), is_scalar() e is_string().