gettype

(PHP 4, PHP 5, PHP 7)
Get the type of a variable
string gettype ( mixed $var )

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

Parameters:
var

The variable being type checked.

Returns:

Possible values for the returned string are:

Examples:
gettype() example
<?php

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

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

?>

The above example will output something similar to:

integer
double
NULL
object
string
See also:

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() -

doc_php
2016-02-24 16:13:56
Comments
Leave a Comment

Please login to continue.