I'm trying to introduce few things that I've learned in languages like Scala and Haskell to PHP and experiment with it. To give a concrete example, I would like to extend the PHP syntax to be able to do something like the following:
array_map( _ + 1, [1,2,3]) // returns [2,3,4]
As I understand it "extending the PHP language" means two things:
- writing an extension in C and putting it as a
php.ini
extension
stanza - extending the language (parser) itself (Zend Engine?) which is written in C
I think I want the second item but I see things like xdebug
that (to me) pretty much delve deep into PHP internals. I was kinda hoping that perhaps I can extend PHP syntax without the need to wrestle with its parser?