DEV Community

Discussion on: PHP needs its own ES6

hamatti profile image
Juha-Matti Santala Author • Edited on

Sure. I took a quite literal ES6 way of thinking here in a way that it would require some compiling/transpiling back to original.

So maybe we could have

  ->filter(function(num) { return num % 2 === 0; })
  ->map(function(num) { return num * 2 ;})

that would then transpile into

   function(num) { return num * 2; },
     function(num) { return num % 2 === 0; }

so that it would be compatible with real deal.

Like I mentioned, I'm not a language designer nor do I know much about how to make languages or compilers but this is the high-level thinking I have.