

Ask HN: If there was a CoffeeScript for PHP, what features would you like? - aoe

There are many of us who cannot switch to another server side language, and would like a syntactic sugar on top of PHP.<p>What kind of features would you like in such a language?
======
leeoniya
1\. uniform function names and parameter orders. for example searching
functions.

2\. better way to define stdClass objects (json-esque). other than
(object)array('foo'=>'bar').

3\. chaniable interfaces for lots of stuff that currently requires storing
results in temp vars.

4\. have closures automatically "use" all local scope variables without
needing to explicitly define them (like js) - this could be problematic though
if you expect to reuse variable names...

have anything implementing all necessary array and iterator interfaces be
passable to functions that take arrays. this is really a core language feature
though, not sugar.

there is a great list of warts you can start itching here:
<http://phpsadness.com/>

------
kaolinite
Not really needed now that PHP 5.4 has it by default (though in reality it'll
be a while before 5.4 is default), but I'd use it if it let me do the
following:

$foo = MyFunction()[2];

It's the one feature in PHP 5.4 that made me genuinely happy.

Another thing I'd love is a doctype of sorts for PHP. So I could go:

<?php uses "5.1.2"; ....

and then the PHP engine will treat itself as if it is PHP 5.1.2 or whatever.
Yeah, not going to happen ever, but it'd be nice.

------
pdenya
better array syntax [] & {}

dot notation instead of ->

methods instead of functions where possible (eg: "test".replace("t", "b"); )

