Live data from Hacker News

PHP 8.0.0 beta 2

php.net

81–90 of 102 posts

Re: PHP 8.0.0 beta 2

#81

Earlier quoted context omitted.

Manipulating complex data structures that are large and/or trying to manage long running processes cause memory leaks. I often find I have to jump through hoops I don't have to in other languages to deal with these kinds of problems, for instance. I usually have to resort to queues, which just adds complexity where I typically don't want it.

> Manipulating complex data structures that are large I do assume it's not the case, but one of the footguns with PHP is that assigning around large variables/arrays and triggering the copy-on-write can end building up the amount of duplicates of that data being kept alive. Pass by reference, unsets, generators and the like aren't used super often due to a lot of runs being small stateless requests, but sometimes the…

We resorted to only giving PHP ready to transmute data, so it didn’t handle any of the manipulation unless it was straightForward based on our own criteria, but anything involving too much searching or filtering (yes I realize there are other problems here, but our scale was large enough that these problems had to be tackled piecemeal, and aren’t relevant beyond that for this discussion)

Ultimately I’ve had less issues with Python for this type of workload and is eventually where we moved.

Re: PHP 8.0.0 beta 2

#82
post #13
post #7

Earlier quoted context omitted.

I have to confess that I have a lot of prejudice against PHP after having to work with it at the time of PHP3 and 4. It seemed like even worse than Perl in the sense of how many things were just bolted on it as a way that the developers could claim "yeah, you can do that with PHP". After having a blog running wordpress hacked twice by mere virtue of being online, I dismissed it for good. I keep hearing about how the…

> after having to work with it at the time of PHP3 and 4 PHP 5 was released 16 years ago and was a massive evolution of the language. The same is true for PHP 5.2, 5.3, and 7. It's safe to say that your conclusions about the language are no longer accurate. > Is there anything that PHP is developing or adopting that can not be had at other established languages? No. I can't think of any reason to start a new project…

Wikipedia? Facebook?

Re: PHP 8.0.0 beta 2

#83
post #79

Earlier quoted context omitted.

I wasn't hosting the blog. It was on webfaction. > infinite number of websites built in PHP and never got hacked! If I look at the logs of my webservers and scan for bots trying to exploit some vulnerability, I would guess that 80%+ of the URLs would indicate a PHP-based webapp. So, yeah, there are many that never got hacked but there are certainly a good amount of PHP apps that have some vulnerability. Should we bla…

Well, php is thought to power something like 80-90% of websites. So you are seeing either the same or disproportionately fewer php sites than you should if php were in fact less secure. But php has been around on the web for a long time as well, so there are a lot of unpatched softwares out there like WordPress. Probably near 99% of those compromised servers run on Linux, so by your logic, Linux is much more secure t…

> So you are seeing either the same or disproportionately fewer php sites than you should if php were in fact less secure.

You'd have to assume that there is an uniform distribution of vulnerabilities and exploits through the whole set of languages used for web development for that to hold. You are begging the question.

> 99% of those compromised servers run on Linux

If the exploits manage to give the attacker root access to the OS, then yes it would be the problem of the OS. But the attack is to get access to the application. So the issue is at the application, not at the OS. You can argue that this is not the fault of the language, though. However given that a whole lot of the PHP defenders here are using "it is the easiest one to deploy" argument, one has to wonder if a platform that makes it so easy to deploy apps should also be held up for the issue of insecure apps based on it.

Re: PHP 8.0.0 beta 2

#84
post #78
post #9

PHP is damn good in certain areas. It is one of the best choices (if not the best choice) for rapid prototyping of a program. Its damn fast to similar alternatives (Python, Ruby, Dart, JavaScript), and the standard library is huge. It does have footguns. I am not a fan of the loose typing, but you can take some steps to mitigate. You can do "===", "strict_types" and type hinting for function input and output. It is s…

Regarding "best language documentation", wait until you meet Elixir. Used to do PHP before transitioning to Elixir. Elixir & community have basically taken documentation to a new level. Other than that, PHP is rock solid when it comes to web stuff.

Do you know of any better Erlang servers? I want to get into Elixir, but the download speed is just awful:

https://github.com/erlang/eep/issues/12

Re: PHP 8.0.0 beta 2

#85

The best language is the one you can make money with or positively affect the world. Please grow up out of this old debate. You all sound like 3 year olds...

You can make money with COBOL. Does it make it the best language? Considering that you can make money with any other language as well?

Re: PHP 8.0.0 beta 2

#86
post #85

The best language is the one you can make money with or positively affect the world. Please grow up out of this old debate. You all sound like 3 year olds...

You can make money with COBOL. Does it make it the best language? Considering that you can make money with any other language as well?

You're comparing COBOL with a language that has namespaces, traits, closures, reflection and just gained a JIT compiler, named arguments, annotations and match expressions.

Exhibit A of your parent's point.

Re: PHP 8.0.0 beta 2

#87
post #84
post #78

Earlier quoted context omitted.

Regarding "best language documentation", wait until you meet Elixir. Used to do PHP before transitioning to Elixir. Elixir & community have basically taken documentation to a new level. Other than that, PHP is rock solid when it comes to web stuff.

Do you know of any better Erlang servers? I want to get into Elixir, but the download speed is just awful: https://github.com/erlang/eep/issues/12

Because of 5 minutes you don't go into another language?

You must be a fast learner then, when 5 minutes is too much.

Re: PHP 8.0.0 beta 2

#88
post #59

Earlier quoted context omitted.

> IMO, no. The language is still near the bottom for both dynamic and "static" typed languages. Why do you say that? It's faster than Python and Ruby for most cases, still extremely simple to deploy, the package manager (Composer) is very predictable and easy to deal with compared to Pip or Rubygems, the documentation is good, etc. It has clean lambda functions that you can pass around easily and has for more than a…

As a statically typed language, I feel like it doesn't even take much to explain why it's actually the worst, except for C. But at least C is necessary in some domains. The type system is weaker than Java, which is a low bar. It has no generics, which means no real containers, no generic functions without dropping all typing, no type-hinted arrays. Arrays are also not objects, so they don't conform to any interfaces,…

> It has no generics, which means no real containers, no generic functions without dropping all typing, no type-hinted arrays.

These things are a little advanced for the likes of me. Any chance you'd be so kind as to give me an example of something I can't easily do because of not having this?

> It's definitely fast for a scripting language! So, that's fair. But it's still way slower than many other good backend languages

But those languages require compilation and deploy cycles that are way longer than just getting files on disk, so the total cycle time of development may end up being longer in many cases. It's a tradeoff. PHP probably shouldn't be used for performance-critical things, sure, but then neither should any other dynamic language.

Re: PHP 8.0.0 beta 2

#89

Earlier quoted context omitted.

> IMO, no. The language is still near the bottom for both dynamic and "static" typed languages. Why do you say that? It's faster than Python and Ruby for most cases, still extremely simple to deploy, the package manager (Composer) is very predictable and easy to deal with compared to Pip or Rubygems, the documentation is good, etc. It has clean lambda functions that you can pass around easily and has for more than a…

> still extremely simple to deploy Hardly. PHP-FPM is a confusing mess to set up, and you're still stuck working around the massive mistake of binding routing to the file system. And I hope you don't try to just rsync up your changes afterwards without some form of blue/green deployments. > the documentation is good There is.. a lot of it, for better or worse. Let's compare the functions for concatenating lists betwe…

> Not of much use without generics. `array` isn't a particularly useful type.

No, but you can do function foo(SomeClass $x) {...} - doesn't that fulfill the use case for most people? Objects are basically fat types, in a sense, no? And since the OOP hierarchy is respected, I can use interfaces or abstract classes here and get basically what I want...?

Re: PHP 8.0.0 beta 2

#90
post #61

Earlier quoted context omitted.

> IMO, no. The language is still near the bottom for both dynamic and "static" typed languages. Why do you say that? It's faster than Python and Ruby for most cases, still extremely simple to deploy, the package manager (Composer) is very predictable and easy to deal with compared to Pip or Rubygems, the documentation is good, etc. It has clean lambda functions that you can pass around easily and has for more than a…

I don't agree with the faster and extremely simple to deploy points, at all. Both objections have to do with php-fpm. it spawns a new php interpreter for every request, which means for example that symfony framework setup (routes, controllers, service dependencies...) have to run before every request. Sure it does that faster than python, but python only needs to do this once. deployment is my personal nightmare. try…

> Both objections have to do with php-fpm.

To be fair the last time I seriously worked with PHP was back when mod_php was still cool. I was able to serve thousands of users on a dual-core Xeon box ~15 years ago - I can only imagine the performance is better in many ways now.

Post reply on HN