PHP.nl

gettype

gettype

Get the type of a variable

string **gettype** mixed $value

Returns the type of the PHP variable . For type checking, use functions. value``is_*

valueThe variable being type checked.

Possible values for the returned string are:

"boolean"``"integer"``"double"``"double"``float``"float"``"string"``"array"``"object"``"resource"``"resource (closed)"``"NULL"``"unknown type"

Voorbeeld: example

<?php

$data = array(1, 1., NULL, new stdClass, 'foo');

foreach ($data as $value) {
    echo gettype($value), "\n";
}

?>
integer
double
NULL
object
string

get_debug_type``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