PHP 8.0.0 beta 2
71–80 of 102 posts
Re: PHP 8.0.0 beta 2
#72Re: PHP 8.0.0 beta 2
#73I'm coming from an academic background and i was looking to learn a new backend language to create simple CRUD type, web applications. I already know c/c++, java, js and some python but after research it seems that Rails, Laravel and Django are the best options for this kind of projects as javascript on the backend is still a mess. So i've made a little comparison between them to choose what to learn.
Rails: It might be the best full stack web development framework from what i'm gathering, but it's declining fast and Ruby has a small market share outside the US.
Django: It's been always the 2nd or 3rd best option. Django 3.0 is going async which looks great on paper but in reality it needs work. It doesn't have a built-in asset pipeline for modern js development on the front-end. It needs plugins for basic stuff like social, api auth etc. Python has libraries for almost everything but the web is not always a first class citizen.
PHP: It is by far the most popular backend language. Libraries are tailored for web development and are probably well maintained because they are used by huge projects(wordpress, magento etc). For the same reason it won't disappear any time soon because it handles most of the information on the web and also billions of dollars in online commerce. Symfony has the most contributors than any backend framework and Laravel is probably the easiest framework to create an MVP with. Developers love Laravel and the community is huge. PHP is also improving and adopting new language features with a more advanced type system.
So the real question is why shouldn't someone learn PHP in 2020 ?
Re: PHP 8.0.0 beta 2
#74Earlier quoted context omitted.
> I was under the impression that PHP's stateless nature, with a whole new instance of everything coming into being for each request A couple issues here. 1. Even if the PHP process exits after each request, memory leaks during the request are still an issue. If I'm looping through 1,000 elements of an array and leaking memory each time, I could end up with a peak memory usage of 100MB when 1MB would've sufficed. Tha…
1. This is likely user error due to a poor understanding of how PHP memory management works. Unless you're using poorly written extensions then memory management in PHP is quite straightforward. 2. There's a large amount of PHP libraries built to do exactly what you're describing. Long lived PHP processes are live in production across the world. Straight up misinformation.
> This is likely user error due to a poor understanding of how PHP memory management works.
This is not what the comment I responding to was talking about. They were talking about memory leaks that were not in userspace. PHP's bug tracker has 943 bugs related to memory leaks[1]. That has nothing to do with understanding "how PHP memory management works".
> Unless you're using poorly written extensions then memory management in PHP is quite straightforward.
How exactly do you know whether an extension is poorly written? In many cases, it doesn't matter because there's exactly one extension that does what you need.
You could also be using poorly-written libraries.
> There's a large amount of PHP libraries built to do exactly what you're describing. Long lived PHP processes are live in production across the world.
I know. I use some, and I have several long-lived PHP processes running right now.
If a memory leak is in PHP itself, no library can fix it.
> Straight up misinformation.
Disagreeing with someone (or not understanding them) doesn't mean they're spreading misinformation.
My point was that memory leaks in the PHP virtual machine are still a problem even if PHP usually runs statelessly. Do you disagree?
1. https://bugs.php.net/search.php?search_for=leak&boolean=0&li...
Re: PHP 8.0.0 beta 2
#75PHP 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…
PHP is basically a wrapper of C modules.
String functions are ($haystack,$needle)
Array functions are ($needle, $haystack)
Because that's the way the underlying modules worked. I had used PHP for a long time without realizing this.
Re: PHP 8.0.0 beta 2
#76Earlier quoted context omitted.
There's been one big change in the last 5 years – the adoption of type-inferring PHP static analysis tools in CI. As companies started adopting TypeScript/Flow into their Javascript pipeline, PHP developers realised the need for something similar in their ecosystem. I work at Vimeo (which has a lot of business logic in PHP) and I took it upon myself to write a static analysis tool (which you can play with at https://…
Thats pretty rad. I'm curious if you guys use PHP at all for any real time workloads. Thats where I've always had struggles with PHP. Also, have you found the event dispatch system of the modern PHP frameworks to be slower over time?
If most of the stuff you're doing requires an event loop I'd consider other options before PHP, but if it's mainly serving web requests PHP is my go-to.
Re: PHP 8.0.0 beta 2
#77Earlier quoted context omitted.
1. This is likely user error due to a poor understanding of how PHP memory management works. Unless you're using poorly written extensions then memory management in PHP is quite straightforward. 2. There's a large amount of PHP libraries built to do exactly what you're describing. Long lived PHP processes are live in production across the world. Straight up misinformation.
Note: I wrote PHP professionally for more than 10 years, and I still maintain several PHP code bases. > This is likely user error due to a poor understanding of how PHP memory management works. This is not what the comment I responding to was talking about. They were talking about memory leaks that were not in userspace. PHP's bug tracker has 943 bugs related to memory leaks[1]. That has nothing to do with understand…
Re: PHP 8.0.0 beta 2
#78PHP 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…
Other than that, PHP is rock solid when it comes to web stuff.
Re: PHP 8.0.0 beta 2
#79Earlier quoted context omitted.
I don't know how can you blame the hacking of your website on the language rather than your admin skills, there infinite number of websites built in PHP and never got hacked!
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…
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 than windows servers, right?
Re: PHP 8.0.0 beta 2
#80Earlier quoted context omitted.
Symfony was the backend framework with the most contributors in 2019[1], and Laravel is seeing some huge growth in the PHP community. I think there's a lot of hype for the modern improvements in the language, and it's quite easy to manage a stateless web server in production making it a safe technology to use. [1]: https://symfony.com/blog/symfony-was-the-backend-framework-w...
Doesn't make it the best backend framework of 2019! In all seriousness, I think this has more to do with the ease of PHP development comparatively to other stacks. Even Python (arguably just as easy to learn as PHP), has more overhead here.