gettype

Views: 7 Last modified: July 31st, 2011 Comments: 0

The function gettype() will check the type of variable and return the type as string. You should not use this function to check types on production servers as it may change in the future development of PHP.

$args = array(
		new stdClass,
		array(),
		'Hello World',
		582.65,
		574,
		false,
		null,
		true
		);

foreach ($args as $type)
	echo gettype($type).'<br />';

The result

object
array
string
double
integer
boolean
NULL
boolean
VN:F [1.9.13_1145]
Rating: 0.0/10 (0 votes cast)
VN:F [1.9.13_1145]
Rating: 0 (from 0 votes)

    Mail this!

    To: From:Sum {2+5} =  
    Anything to add ?

        You must be logged in to post a comment.