3 ms·
Since when are there pointers in PHP?
by dgabriel 16y ago
Since when are there pointers in PHP?
- pilif 16y agothere are none, but to implement a callback you also wouldn't have to declare an inner class implementing some interface that in turn declares tens of methods just to react to that one callback. In PHP 5.3 you'd just pass the function (which of course will pass a pointer to that function) and in earlier versions you'd hack something with eval or variable-variables which, while bad, is still better than either writing half a screen full of empty methods or inheriting an inner class from some meaninglessly named class that only exists for you not to have a screenful of empty methods.
- wvenable 16y agoIn all versions of PHP, callbacks are extremely easy (no eval or variable-variables required). You just have to pass the name of function or method around and use the call_user_func() function to call it.