4 ms·
> PHP likes to pretend it's a dynamic language (Closures, for instance), PHP is a dynamic(ally typed) language, and closures have nothing to do with static/dyn
by masklinn 14y ago
> PHP likes to pretend it's a dynamic language (Closures, for instance),
PHP is a dynamic(ally typed) language, and closures have nothing to do with static/dynamic.
> at its core it's a very strange dynamic/static hybrid
No, at its core it's completely dynamically typed, it got static features when it decided to base its OO on Java's.
> Which is why this doesn't work:
This doesn't work because PHP uses a shitty ad-hoc parser for a shitty ad-hoc syntax, much like closures it's completely orthogonal to the language being dynamic or static.
Also, this piece of code doesn't involve any closure. It looks like you don't know what a closure is.
- TazeTSchnitzel 14y ago>Also, this piece of code doesn't involve any closure. It looks like you don't know what a closure is. Yes it does, it executes what PHP calls a "Closure": http://php.net/manual/en/class.closure.php http://php.net/manual/en/class.closure.php
- deleted 14y ago[deleted]
- encoderer 14y agoActually, not really. Your code breaks on any PHP "callable" http://php.net/manual/en/language.types.callable.php http://php.net/manual/en/language.types.callable.php of which Closures are just one.
- TazeTSchnitzel 14y agoI'm well aware of that. Although it seems PHP tried to treat it as a string callable IIRC.