Logo

Programming-Idioms

History of Idiom 94 > diff from v39 to v40

Edit summary for version 40 by ancarda:
[PHP] Format code snippet to PSR-12

Version 39

2019-09-26, 22:17:24

Version 40

2019-09-27, 09:10:29

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 is_object($x) ? 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