News for hackers. Stuff that matters.
Re:Ewww, You Use PHP? by dgabriel on Friday October 22, 2010 @07:53AM (#1819315)
Since when are there pointers in PHP?
Re:Ewww, You Use PHP? by pilif on Friday October 22, 2010 @08:11AM (#1819365)
there 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.

Re:Ewww, You Use PHP? by wvenable on Friday October 22, 2010 @12:54PM (#1820396)
In 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.