Logo

Programming-Idioms

Print the name of the type of x. Explain if it is a static type or dynamic type.

This may not make sense in all languages.
Implementation
PHP

Implementation edit is for fixing errors and enhancing with metadata. Please do not replace the code below with a different implementation.

Instead of changing the code of the snippet, consider creating another PHP implementation.

Be concise.

Be useful.

All contributions dictatorially edited by webmasters to match personal tastes.

Please do not paste any copyright violating material.

Please try to avoid dependencies to third-party libraries and frameworks.

Other implementations
import "reflect"
fmt.Println(reflect.TypeOf(x))
print ref($x)||"SCALAR", "\n";
print(type(x))
import std.stdio: writeln;
writeln(typeid(x));
import Data.Dynamic
print (dynTypeRep (toDyn x))
System.out.println(((Object)x).getClass().getName());
System.Console.WriteLine( x.GetType() );
puts x.class
print(type(x))
print(x.__class__)
#![feature(core_intrinsics)]
fn type_of<T>(_: &T) -> &'static str {
    std::intrinsics::type_name::<T>()
}

println!("{}", type_of(&x));
fmt.Printf("%T", x)
print(x.runtimeType);
console.log(typeof x);
console.log (x == null ? x + '' : x.constructor.name);
#include <typeinfo>
std::cout<<typeid(x).name();
(type x)
println(x::class.simpleName)
[{_, type} | _] = IEx.Info.info(x)
type
import java.lang.reflect.Modifier;
System.out.print(x.getClass().getName());
if(x.getClass().getModifiers() == Modifier.STATIC) {
	System.out.println(" is static");
} else {
	System.out.println(" is dynamic");
}
(describe x)