Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

They're also the ones bringing PHP into the modern world and making it much harder to sneer at.

There are some plain-crazy things about this language, but there are also some plain-crazy things about other popular languages too. It's like we forget that JavaScript was absolutely reviled for over a decade. PHP is undergoing a JavaScript-like transformation, though it will never get that kind of popularity because of the lack of client-side browser usability.



Maybe it's just me, but isn't JavaScript still looked down on? There's a reason languages are being written on top of it, and lots of frameworks to patch up the terrible usability of it. Just because it's popular doesn't mean it's great.


Yeah, somewhat. However, despite frameworks like Node, JavaScript is a client-side language. So even if you fuck up horribly with it, the damage you cause will be minimal. Not so with PHP.


JavaScript is commonly used for writing server software or even systems software nowadays.

Also, an exploitable XSS in your web application can be just as damaging as a server compromise.


Can XSS be used to drop your Users table?


Yeah it's definitely improving. But last I checked the PHP internals team was very reluctant to change anything, even plain-crazy stuff, to maintain backward compatibility. In PHP, if a bug sticks around long enough, it becomes a feature.

I'm not a purist, if you're making money coding PHP more power to you. Around here there are a lot of businesses hiring people to make them Wordpress sites. But an aspiring dev asks me what language to learn I don't recommend it.


You've definitely nailed the problem. It's all about backwards-compatibility. Most of the plain-craziness I see day to day is in the Array methods, which certainly is annoying.

There's also some crazy defaults with json_encode which you actually need to send a flag to disable to get valid UTF-8. JSON_UNESCAPED_UNICODE, I am looking at you...interestingly enough they set the default to not cause buggy JSON parsers people use to blow up. Not a choice I would have made, but I guess they like to be nice to their users. It would be nice if their documentation for this function gave a more prominent message about this.

To address your second point though, I wouldn't advise that anyone learn _any_ language specifically. I would have them address concepts directly and try to be language agnostic. JavaScript would be the closest thing just for employability reasons, but it has way too many JavaScript-specific quirks for me to recommend someone to base their career on it.


I mean obviously there is no one-size-fits-all recommendation. It depends a lot what their goals and background are.

I started out learning PHP on a LAMP stack on an old laptop, and reading C tutorials online. Probably my best move was working through SICP.

If they were math-inclined and weren't worried about immediate employability I'd recommend SICP even though Scheme is irrelevant in industry.

But if they wanted to make money as a web dev as fast as possible, JavaScript makes sense.


I didn't start with SICP, but going through the first three chapters is probably the single thing that kickstarted my transformation from hobbyist programmer to professional. The next was Eloquent Ruby and then Clean Code.


Oh I didn't start with SICP either, I programmed very casually as a hobby for years before that


Imagine. PHP in the browser. A competitor to JavaScript on so many levels.


I bet someone somewhere is working on a PHP interpreter in Javascript.

Ninja edit: yep. (http://asmblah.github.io/uniter/demo/interactive.html)


Also: PHP has a JavaScript engine, V8js (http://php.net/manual/en/book.v8js.php)

So you could run a PHP VM on top of a Javascript VM in PHP.


Woah, that's all kinds of meta.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: