Reputation: 22314
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:
php.ini
extension
stanza 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?
Upvotes: 0
Views: 243
Reputation: 36764
To modify PHP's syntax you need to modify its parser. This is not something you can do with an extension. Xdebug might delve deep into the engine, but it only reads information.
Upvotes: 4