13.3 Tracing types

$type is a compile-time mechanism being called like a function, with a single argument. The compiler evaluates the argument expression and then outputs the type of that expression.

This is useful to evaluate if an expression has a certain type, mostly when dealing with Type inference, which leaves the definition of the type up to the compiler.

var myValue = "foo";
$type(myValue); // String