echo gettype

PHP
gettype($u)
Source

Also in PHP: