Logo

Programming-Idioms

History of Idiom 94 > diff from v15 to v16

Edit summary for version 16 by :
[PHP] return class name if $x is object

Version 15

2016-02-26, 16:30:23

Version 16

2016-02-26, 16:50:37

Idiom #94 Print type of variable

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.

Idiom #94 Print type of variable

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.

Code
echo gettype($x);
Code
echo gettype($x)=="object" ? get_class($x):gettype($x);
Comments bubble
$x is dynamic type
Comments bubble
$x is dynamic type