8 ms·
PHP 8.0.0 beta 2
- tambourine_man 6y agoPHP is seeing a renascence and renewed interest similar to what happened with JavaScript a few decades ago. A language that's easy to make fun of but widely used is an attractive target for improvement.
- outime 6y agoMaybe I'm not in the right circles but I see absolutely no renewed interest towards PHP. Is there any reason to believe that? Honest question - PHP was my first language (or second if you want to consider mIRC scripting) and I have not so bad memories but at least me and everybody I know moved away from it years ago and don't see people going back to it anytime soon.
- muglug 6y agoThere'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://psalm.dev https://psalm.dev). Other similar static analysis tools were developed at other places that use PHP, and together they have helped make modern-day PHP development a little more orderly.
- no_wizard 6y agoThats 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?
- muglug 6y agoI've used PHP in a realtime setting as part of Psalm's Language Server, but it's clearly not built for such workloads – the lack of native async support gets in the way. 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.
- outime 6y agoYour example is similar to a WordPress developer saying they adopted modern PHP - sure, they were on PHP already. But at least Vimeo still wanted to stick to PHP so that's one positive point.
- Syntaf 6y agoSymfony 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-with-the-most-contributors-in-2019 https://symfony.com/blog/symfony-was-the-backend-framework-w...
- no_wizard 6y agoDoesn'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.
- no_wizard 6y agoFor context for talking off the cuff, I’m not certain that this equates to a raw quality, having used Symfony professionally for a few years I found there where a lot of limitations, particularly around the dependency injection and event dispatch system, that required a lot of work to keep performant because of the inherited limitations of PHP as well as what I feel were not the best design decisions around this idea, but I’m glad so many others have had great success here
- stanmancan 6y agoI mean surely that depends on the crowed you hang around with. Majority of people I interact with use PHP primarily. Anecdotal evidence isn't great at identifying trends.
- neovive 6y agoThe Laravel framework (https://laravel.com https://laravel.com) and its growing ecosystem and welcoming community is a great example of this renaissance.
- smt88 6y agoIs it? Laravel effectively has a single maintainer, as its other contributors seem to have abandoned it[1]. It also seems to have declining interest after peaking in 2017[2]. EDIT: I was looking at the wrong repository, so my comment about Laravel's popularity is wrong. 1. https://github.com/laravel/laravel/graphs/contributors https://github.com/laravel/laravel/graphs/contributors 2. https://trends.google.com/trends/explore?date=today%205-y&geo=US&q=laravel https://trends.google.com/trends/explore?date=today%205-y&ge...
- apocalyptic0n3 6y agoYou're looking at the bootstrap install repo. That's barely changed since 5.0 was released in 2015-ish. The framework repo[1] is still being maintained by many different developers and sees a significant new release every 6 months. Taylor still accounts for a significant amount of contributions, but it is his project afterall. Also worth noting that the framework has pretty much reached maturity at this point and updates are more focused on stability and bug fixes than new features. A lot of the work being done is on the ecosystem being built around Laravel (see "The Laravel Ecosystem" on [2]), with Taylor currently teasing another new piece to the ecosystem to be released with Laravel 8 in a few weeks that apparently involves inertia.js (whose maintainer is a speaker at the Laracon event too, if I remember correctly) 1: https://github.com/laravel/framework/graphs/contributors https://github.com/laravel/framework/graphs/contributors 2: https://laravel.com/ https://laravel.com/
- apocalyptic0n3 6y agoAs an addition to this, it's also worth noting that Laravel has enough development going on to support at least 4 full time employees that I'm aware of, in addition to Ottwell himself working full time on it.
- edgarvaldes 6y agoI don't think PHP _needs_ a renascence. It's already a widely used language, so I prefer it to keep growing the good parts and leaving behind the bad old habits.
- smt88 6y ago> PHP is seeing a renascence and renewed interest I have seen no PHP renaissance anywhere (real life, Hacker News, reddit, or anywhere else), but I also checked TIOBE[1]. PHP's popularity peaked in 2006, when it was 500% as popular as it is now. 1. https://www.tiobe.com/tiobe-index/php/ https://www.tiobe.com/tiobe-index/php/
- mrrsm 6y agoPHP, since version 7.0, has been a much improved language since when many people started hating on it. They have been consistently moving the spec forward and making improvements. It's not perfect, but no language really is after all. It is really nice just seeing issues that have been around for a long time being addressed and fixed.
- rglullis 6y agoI 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 language has improved, but to me it feels like even if the language gets rid of all its heaps of crap, it still is in a evolutionary dead-end. Is there anything that PHP is developing or adopting that can not be had at other established languages? (Edit: I never had something downvoted so fast before. This is not concern trolling. I seriously would like to know if it makes sense for a non-PHP developer to look into it)
- smt88 6y ago> 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 with PHP today. All of its best features are things that have been available in other languages for years. It's also not particularly popular outside of WordPress.
- wyck 6y agoWordPress accounts for approximately 60% of all websites, PHP accounts for approximately 79% (knows server side sites). So I would say it is particularity popular.
- no_wizard 6y agoIf the JIT for PHP ever becomes good enough it solves the memory leak problems PHP to this day is still plagued with, that might be enough to convince me to use PHP again, possibly, for some workloads. I can't help but feel that PHPs popularity is mostly tied to Wordpress, and to a lesser extend Laravel (with Symfony coming in behind that). Not really sure the rest of the ecosystem even matters, outside those core pieces. I'd love to see it fix alot of landstanding issues, and I love that the language has moved forward. I've worked with it professionally over the last few years in various places, and I don't particularly dislike so called "modern" PHP, but its only really good at very specified problem domains (mostly, you have a website, need to display said website. I always had scaling problems for anything other than using it in the context of a template language or very straightfoward database access. Real time APIs? nope. Just couldn't get it done, too much memory pressure)
- webignition 6y agoWhat are the memory leak problems? I was under the impression that PHP's stateless nature, with a whole new instance of everything coming into being for each request, somewhat sidesteps the capacity for problematic memory leaks that could otherwise exist for processes that remain alive between requests.
- diek 6y agoMost web workloads will use some sort of process cache, like php-fpm, simply because spawning a process for each request is very inefficient. So the process and any extensions used can leak memory over time across requests.
- wanderr 6y agophp-fpm is typically configured to restart those processes after some number of requests, just in case there is such a leak. But I have not seen those leaks happen between process restarts, state is still wiped clean between requests, so leaks should be rare/difficult and probably most likely the result of faulty extensions.
- 6y ago
- svnpenn 6y agoPHP 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 similar to C in that the language itself doesnt really do much to stop you from writing bad code. Also the function naming is not consistent, and even function arguments are not consistent. However PHP 8 will help with that somewhat, as you can now do named arguments. Also PHP has the best language documentation I have ever seen. I would prefer more examples, but its well above some other languages.
- SwiftyBug 6y agoI can't believe named arguments aren't default in every language. TypeScript could have implemented it.
- ht85 6y agohttps://github.com/Microsoft/TypeScript/issues/467#issuecomment-354537675 https://github.com/Microsoft/TypeScript/issues/467#issuecomm...
- beberlei 6y agoa few of the footguns are also getting removed in PHP 8 by stricter and more consistent number to string comparisons: https://wiki.php.net/rfc/string_to_number_comparison https://wiki.php.net/rfc/string_to_number_comparison https://wiki.php.net/rfc/saner-numeric-strings https://wiki.php.net/rfc/saner-numeric-strings In addition more internal functions throw exceptions instead of notice+return false on completly invalid arguments: https://wiki.php.net/rfc/consistent_type_errors https://wiki.php.net/rfc/consistent_type_errors
- colecut 6y agoThe creator of PHP addressed the "function arguments not consistent" issue in a YouTube video called 25 years of php. 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.
- toupeira 6y agoArticle with an overview of the changes: https://stitcher.io/blog/new-in-php-8 https://stitcher.io/blog/new-in-php-8 Some highlights are union types, a JIT compiler, named arguments, annotations, and match expressions. The approach to named arguments is interesting. It's nice that you don't have to change the signature of existing functions, but the downside seems to be that you can't enforce the usage of named arguments on callers, as in other languages like Ruby and Python where keyword arguments need to be declared as such. function foo(string $a, string $b, ?string $c = null, ?string $d = null) { /* … */ } foo( b: 'value b', a: 'value a', d: 'value d', );
- Denvercoder9 6y ago> Python where keyword arguments need to be declared as such. In Python you don't need to explicitly declare keyword arguments either (though it is possible). This is perfectly valid and working: def foo(a: str, b: int, c: bool=None, d: float=None): pass foo(b=5, a='something', d=3.0) # is equivalent to foo('something', 5, None, 3.0)
- toupeira 6y agoThanks, TIL!
- ausjke 6y agoI heard about PHP is really just used by wordpress and drupal to keep its popularity ranking these days, and new projects seldom adopt it based on google trends, is this true? The new PHP7/8 is certainly exciting, is it too late?
- kugelblitz 6y agoI do contract development work, haven't touched Wordpress in 10 years, never touched Drupal. I mostly work with the Symfony and Laravel frameworks.
- mcdramamean 6y agoThe 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...
- azangru 6y agoYou can make money with COBOL. Does it make it the best language? Considering that you can make money with any other language as well?
- hu3 6y agoYou'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.
- brian_herman__ 6y agoHopefully this will change Apple's mind. https://twitter.com/GrahamJCampbell/status/1295111982924861442 https://twitter.com/GrahamJCampbell/status/12951119829248614...
- kyriakos 6y agoI think this is irrelevant, apple just moved scripting language support out of their OS bundle. They blew it with that warning message though.
- yagodragon 6y agoI think it is possible that PHP is still the best choice for web development in 2020. I'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 ?
- _nothing 6y agoHonest question: If I'm an American programmer, is there any reason I need to care about Ruby's market share outside the US?