Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

PHP doesn't allow you to pass functions and classes as arguments.


You can. Here's my code as an example:

https://github.com/gigablah/fsphinxphp/blob/master/src/FSphi...

Note the $getter parameter.


Unless I'm misunderstanding you, passing functions as arguments is definitely possible with anonymous functions/closures.




Consider applying for YC's Fall 2026 batch! Applications are open till July 27.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: