TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

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

8 pointsby aoeabout 13 years ago
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?

3 comments

leeoniyaabout 13 years ago
1. uniform function names and parameter orders. for example searching functions.<p>2. better way to define stdClass objects (json-esque). other than (object)array('foo'=&#62;'bar').<p>3. chaniable interfaces for lots of stuff that currently requires storing results in temp vars.<p>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...<p>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.<p>there is a great list of warts you can start itching here: <a href="http://phpsadness.com/" rel="nofollow">http://phpsadness.com/</a>
kaoliniteabout 13 years ago
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:<p>$foo = MyFunction()[2];<p>It's the one feature in PHP 5.4 that made me genuinely happy.<p>Another thing I'd love is a doctype of sorts for PHP. So I could go:<p>&#60;?php uses "5.1.2"; ....<p>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.
pdenyaabout 13 years ago
better array syntax [] &#38; {}<p>dot notation instead of -&#62;<p>methods instead of functions where possible (eg: "test".replace("t", "b"); )