

Ask HN: Is PHP datatyping broken? - superice

This gives an error:
&lt;?php
$class = new StdClass();
$output = (null) $class;
var_dump($class);<p>This outputs an empty object:
&lt;?php
$object = (Object) null;
var_dump($object);<p>Why is this?!
======
kao98
(null) type casting is not authorized in php. See
[http://php.net/manual/fr/language.types.type-
juggling.php](http://php.net/manual/fr/language.types.type-juggling.php) for
information about type juggling.

And what do you think should happen in the second case? It looks normal to me.

