Re:Upcoming changes in PHP 7.1
by tokenizerrr on Monday May 23, 2016 @08:42AM
(#11753457)
This is the same as other languages. In for example Java you have `public void method()`, and you then `return` which results in a `null`
[ Parent
| on HN ]
Re:Upcoming changes in PHP 7.1
by TazeTSchnitzel on Monday May 23, 2016 @08:43AM
(#11753463)
Are you sure about that? I don't think you can use the results of void functions in Java as expressions.
This is completely incorrect. Java's null value is only valid as a value of an object type (e.g, Object x = null), and void functions don't return an object.
Re:Upcoming changes in PHP 7.1
by tokenizerrr on Monday May 23, 2016 @03:36PM
(#11756278)
The compiler doesn't allow it, but if you call the function with for example reflection you get null.