gettype

Resituisce il tipo di una variabile

string gettype(mixed $var)

Resituisce il tipo della variabile PHP var. Per controllare il tipo, utilizzare le funzioni is_*.

var La variabile di cui controllare il tipo.

I valori possibili per la stringa restituita sono: "boolean" "integer" "double" (per ragioni storiche viene restituito "double" nel caso di un float, e non semplicemente "float") "string" "array" "object" "resource" "NULL" "unknown type"

Esempio di gettype <?php $data = array(1, 1., NULL, new stdClass, 'foo'); foreach ($data as $value) { echo gettype($value), "\n"; } ?> Example outputs similar integer double NULL object string

settype get_class is_array is_bool is_callable is_float is_int is_null is_numeric is_object is_resource is_scalar is_string function_exists method_exists