Logo

Programming-Idioms

History of Idiom 94 > diff from v16 to v17

Edit summary for version 17 by :
[PHP] code more clear

Version 16

2016-02-26, 16:50:37

Version 17

2016-02-26, 16:53:41

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)=="object" ? get_class($x):gettype($x);
Code
echo is_object($x) ? get_class($x):gettype($x);
Comments bubble
$x is dynamic type
Comments bubble
$x is dynamic type