Live data from Hacker News

PHP 7 Virtual Machine

nikic.github.io

91–100 of 128 posts

Re: PHP 7 Virtual Machine

#91
post #72

Earlier quoted context omitted.

Do you have any pointers to the recommended Right Way to do modern PHP? I'd be interested to explore it; I have a number of places where I want to add tiny bits of interactivity to otherwise static web pages, and this totally seems to be what PHP does best.

http://phptherightway.com is a good place to start, if you haven't read it before. It's opinionated, and not necessarily a guide follow down to the letter, but it can put you on the right track.

Ha ha --- I should have thought to search for that!

It seems to be a bit light on advice in places. e.g. the section on comparison operators lightly mentions the difference between == and === but doesn't say anything about when they should be used. As that's one of the traditional PHP gotchas I would have expected more there.

Anyway, thanks; I'll check it out.

Re: PHP 7 Virtual Machine

#92
post #21

Earlier quoted context omitted.

nodejs is imho best suited for two groups of tasks: 1) APIs/programs relying on high concurrency and parallelism, especially where the handler(s) have to wait a lot for stuff like DB accesses 2) streaming (in the sense of websockets servers), PHP iirc can't even be used as a websocket server 3) Any API that can be implemented without needing too many async calls - you'll end up in callback hell or promise hell otherw…

> PHP iirc can't even be used as a websocket server True, if you run it behind a web server like 99.999% of all users. If you run it as a cli script, you can implement pretty much anything. I saw a ftp server once. Crazy. Still, even on a normal web server, php can do long polling perfectly fine, which is often enough. > being able to write program flows without dozens of promises is a breeze It is a breeze with asyn…

> If you run it as a cli script, you can implement pretty much anything. I saw a ftp server once. Crazy.

Yeah, I implemented a simple ircd once. Funny days... but I don't know of any library/framework that could help you with the websocket protocol level, and I'm too old for writing my own ;)

Re: PHP 7 Virtual Machine

#93
post #19
post #8

Earlier quoted context omitted.

PHP is a whole lot more than just a templating engine. I think you would find that much more effort than is required just to make some templates.

I actually assumed this is a joke/trolling attempt, since it was a common joke to despisingly call PHP a "templating engine" a few years ago. But the follow-up seems so sincere that I don't even know what to think anymore...

In terms of community impact, assuming bad faith is not far removed acting in bad faith. Both will inevitably drag down the level of discourse.

Re: PHP 7 Virtual Machine

#94
post #75
post #36

Earlier quoted context omitted.

Honestly. I think its main problem is it's not hipster enough. It's too popular. I bet if you made it difficult to use (for most people), added features that make certain aspects a nightmare to scale and gave it a weird name then it would do well here. Obviously don't let anyone know about the origin... say you built it at a series of obscure coding bootcamps.

I think that's unfair, the reason PHP has a bad reputation is not because of silly hipsters. It's because for a long time it was a terribly designed language. It was a laughing stock for a good reason. The whole "hobby-grade templating language turned general purpose with complete disregard to how programing languages are designed" thing. Now I'm willing to believe that it's improved a lot since then, but it's got a…

I'm pretty sure a substantial part of PHP's reputation is the nightmare code produced by PHP developers.

Re: PHP 7 Virtual Machine

#95
post #67

Earlier quoted context omitted.

If you care about performance and traffic, perhaps php isn't where you should start anyway.

Uh. You do realize that Mediawiki, powering nearly all wiki systems including Wikipedia, is written in PHP. Or Facebook, they were able to go with PHP for iirc 500 M users? PHP is in any case a better choice, performance-wise, than Python or, god forbid, Java.

PHP performs better than Java? Care to offer evidence?

Re: PHP 7 Virtual Machine

#96
post #75
post #36

Earlier quoted context omitted.

Honestly. I think its main problem is it's not hipster enough. It's too popular. I bet if you made it difficult to use (for most people), added features that make certain aspects a nightmare to scale and gave it a weird name then it would do well here. Obviously don't let anyone know about the origin... say you built it at a series of obscure coding bootcamps.

I think that's unfair, the reason PHP has a bad reputation is not because of silly hipsters. It's because for a long time it was a terribly designed language. It was a laughing stock for a good reason. The whole "hobby-grade templating language turned general purpose with complete disregard to how programing languages are designed" thing. Now I'm willing to believe that it's improved a lot since then, but it's got a…

Agree with you, and let's not forget that JavaScript has similar origins.

Re: PHP 7 Virtual Machine

#97
post #95

Earlier quoted context omitted.

Uh. You do realize that Mediawiki, powering nearly all wiki systems including Wikipedia, is written in PHP. Or Facebook, they were able to go with PHP for iirc 500 M users? PHP is in any case a better choice, performance-wise, than Python or, god forbid, Java.

PHP performs better than Java? Care to offer evidence?

Can't disclose much in public, but our PHP CMS hosting requirements tend to be waaaay cheaper than our Java-based CMSes. Also, deployment of PHP apps is (in my experience) faster and easier.

Re: PHP 7 Virtual Machine

#98
post #86
post #36

Earlier quoted context omitted.

Honestly. I think its main problem is it's not hipster enough. It's too popular. I bet if you made it difficult to use (for most people), added features that make certain aspects a nightmare to scale and gave it a weird name then it would do well here. Obviously don't let anyone know about the origin... say you built it at a series of obscure coding bootcamps.

On the contrary, I dislike PHP because I find it so difficult: its bad documentation, its badly designed standard API, the many badly designed and badly documented frameworks to replace the badly designed API, and the core language that goes out of its way to let buggy code through all combine to make writing medium-sized and above programs extremely difficult. Supposedly it's better now. I'm skeptical.

I'm with you on most of these, but disagree on the documentation. The main PHP code is quite well-documented, even from way back, which contributed to its popularity.

Re: PHP 7 Virtual Machine

#99
post #67

Earlier quoted context omitted.

If you care about performance and traffic, perhaps php isn't where you should start anyway.

Uh. You do realize that Mediawiki, powering nearly all wiki systems including Wikipedia, is written in PHP. Or Facebook, they were able to go with PHP for iirc 500 M users? PHP is in any case a better choice, performance-wise, than Python or, god forbid, Java.

Facebook built their own PHP-to-C++ compiler (https://en.wikipedia.org/wiki/HipHop_for_PHP) and later a JIT compiler/VM (https://en.wikipedia.org/wiki/HipHop_Virtual_Machine), with a custom, typed version of PHP (https://en.wikipedia.org/wiki/Hack_(programming_language) ).

All just to make PHP a little faster. I think you are making my case.

Re: PHP 7 Virtual Machine

#100
post #75

Earlier quoted context omitted.

I think that's unfair, the reason PHP has a bad reputation is not because of silly hipsters. It's because for a long time it was a terribly designed language. It was a laughing stock for a good reason. The whole "hobby-grade templating language turned general purpose with complete disregard to how programing languages are designed" thing. Now I'm willing to believe that it's improved a lot since then, but it's got a…

I'm pretty sure a substantial part of PHP's reputation is the nightmare code produced by PHP developers.

And that goes right into the whole "badly designed language" trope as well. Essentially, anything written in PHP prior to version 5 (and especially prior to version 4) should be considered suspect.

I'm a long time PHP developer (well, was until recently - my current position is in the javascript/nodejs stack arena), and have been using it since the v3 days (so not there from the beginning, but close enough). There were some truly awful examples and code practices out there.

That isn't to say you couldn't write quality procedural PHP back in the day (had you configured your server properly and stuck with "best practices") - it's just that the majority of people hacking on PHP didn't. I'm sure there were a few that did, though - but I'm hard-pressed to recall any at the moment.

Today's PHP is a much different beast than yesterday's. The OOP model and other advancements makes things so much better, provided they are all used properly and followed. Now - could you make PHP 7 as ugly as 3? Sure. But you'd be insane to do so unless you had no other choice...

Post reply on HN