php get typeof code example Example 1: typeof php gettype($var); Example 2: check type in php gettype ( mixed $var ) : string