10 ms·
PHP 8.5
- nick-sta 11mo agoLooking forward for true async to land - nothing here gets me too excited.
- hu3 11mo agoYou probably know about https://openswoole.com https://openswoole.com right?
- tguvot 11mo agostill remember been on #php with count down to php3 announcement
- dotancohen 11mo agoI remember the discussions at the time about which filename extension to use - and I can not believe that .php3 won. I think that I was the first to bring up the subject for PHP 4, to use .php again and not include the version number.
- tguvot 11mo agoi still have phtml and php3 files somewhere in backups. used to run on php one of biggish local sites that you probably know
- dotancohen 11mo agoStarts with the letter R? PHP of that era, completely procedural with concatenated SQL, such fond memories.
- tguvot 11mo agonot with R. with P
- dalemhurley 11mo agoThe most exciting thing about the PHP8.5 announcement is the stability and maturity of PHP
- calpaterson 11mo agoA lot of people are too proud to be associated with PHP. I am ready to admit that know nothing about the language except that a lot of people make cool things with it. My favourite PHP product at the moment is BookStack (https://www.bookstackapp.com/ https://www.bookstackapp.com/), a really good wiki. I run an instance for my family and it's great. But there are loads of things. And I notice that many of the sites I like using...are built on well maintained PHP stacks.
- nake89 11mo ago> A lot of people are too proud to be associated with PHP. How so?
- type0 11mo agoVanity, it's "PersonalHomePage" language
- misiek08 11mo agoA lot of mediocre devs sitting at corporations that migrated from PHP to Java and currently can’t write relatively good code in any language make jokes of PHP, because it was popular for some time. They won’t admit the language gave them food, they have no idea how language looks today and are way too proud to admit any of that.
- nusl 11mo agoPHP is a very pleasant and straight-forward language to work with. I enjoyed my time working with it, though I did also see quite a lot of very poor code. I think the danger with PHP is more its ability to easily cause *very bad things*. This would partially be poor training (my University literally taught PHP with SQL-injectable examples), and I think the language itself making it very easy, such that less-experienced developers using it - most of them, early on - don't realise what's wrong until it's gone wrong. With PHP being such an early tool online, and the above properties existing, it earned a reputation for being insecure and bad.
- 11mo ago
- f311a 11mo agoPHP becomes a complex language with each update. For what reason? Its application is still limited to the web, mostly.
- dotancohen 11mo agoI downvoted you before reading the fine article. I'm back to correct that. The new array_first() and array_last() functions are nice, everything else is either reimplantation of existing features or "features"which will make maintainability more difficult. The pipe operator is one such example. I don't need it - these nested methods are not really an issue in any codebase I've seen. The new syntax only works for unary functions, so higher arity functions must be wrapped in an arrow function. It's a mess and more bug prone than just nesting the functions.
- pbowyer 11mo ago> The pipe operator [...] syntax only works for unary functions, so higher arity functions must be wrapped in an arrow function. It's coming - but to get PHP RFCs to pass they have to be salami-sliced, otherwise they're voted down. https://wiki.php.net/rfc/partial_function_application_v2 https://wiki.php.net/rfc/partial_function_application_v2
- ljm 11mo agoThe pipe operator makes it much easier to create home-grown cryptographic hash functions, as everybody used to do in the early 2000s: md5($password) |> sha1(...) |> sha1(...) |> md5(...) |> rot13(...) |> crc32(...)
- dotancohen 11mo agoOh, now I'm convinced!
- dgb23 11mo agoMany of the newer features have this problem. Like the match keyword, enums, closures etc. They are half-baked versions of what could be powerful and expressive features. Meanwhile it seemingly abandoned features and unique selling points, like the in-built templating, associative arrays with value semantics and the fact that it integrates well with C or the simple fact that it can be used to write web server scripts very easily. To me, many of these cool features have been largely ignored or even moved away from.
- gregoriol 11mo agotl;dr: nothing interesting, just stability and maturity
- Cthulhu_ 11mo agoAnd a pipe operator, which is also being discussed in a number of other languages.
- senfiaj 11mo agoIt seems that pipe operator was introduced largely because PHP arrays and strings don't have "methods". You can't write something in "OOP" style: "some_string"->str_replace("some", "replacement")->strtoupper(). With PHPs array / string procedural way writing such chains is much bulkier. Pipe operator will somewhat reduce the boilerplate, but the native "OOP" style is still much better. Although there is a proposal for adding "methods" but I don't remember the link. I'm not a blind PHP hater, but it seems like PHP community members sometimes celebrate new PHP features when their equivalents have been there for many years in other programming languages. https://waspdev.com/articles/2025-06-12/my-honest-opinion-about-php https://waspdev.com/articles/2025-06-12/my-honest-opinion-ab...
- johannes1234321 11mo agoNo, the OOP style isn't better. The set of functions one can use in OOP is closed. Imagine I want to AfD a custom string function for a feature which uPpErCaSeS every second letter as I need that for some purpose: I can't do in OOP style. In OOP I could extend the string class, but most other parts of the code won't magically use my string type now. Thus I have to create a free standing function for this (which probably also is better as I don't need internal state of thee object, thus livingnoutisde is good for encapsulation) And thus my string function works different from other string functions. my_casing($string->trim())->substr(3); (The example of course is non sensical and could be reordered, but we argue syntax) Having them all be simple functions makes it equal. Of course there are alternative approaches. C++ argues for years about "uniform call syntax" which would always allow "object style" function calls, which could also find non-memwbr functions where the first argument is of compatible type, but such a thing requires stricter (or even static) typing, this won't work in PHP.
- boxedemp 11mo agoPHP has really come a long way since I used it in the 90s on my first little website.
- mg 11mo agoWhen I look at the new pipe syntax ... $output = $input |> trim(...) |> (fn (string $string) => str_replace(' ', '-', $string)) |> (fn (string $string) => str_replace(['.', '/', '…'], '', $string)) |> strtolower(...); ... I think why not just something like the following? $output = $input |> trim($) |> str_replace(' ', '-', $) |> str_replace(['.', '/', '…'], '', $) |> strtolower($);
- Epskampie 11mo agoThe three dots in trim(...) make a callable out of a function, that was already in, so seem best to re-use that syntax, at least for now. [1] As for the partial function application, there is already an RFC to add that, but it's not decided on as of now. [2] 1: https://www.php.net/manual/en/functions.first_class_callable_syntax.php https://www.php.net/manual/en/functions.first_class_callable... 2: https://wiki.php.net/rfc/partial_function_application_v2 https://wiki.php.net/rfc/partial_function_application_v2
- 2WSSd-JzVM 11mo agoThat example in article is straight up terrible. The Java version would be: var input = "Some kind of string."; var output = Optional.of(input) .map(i -> i.trim()) .map(i -> i.replace(' ', '-')) .map(i -> i.replaceAll("[./…]", "")) .map(i -> i.toLowerCase()) .get(); That is until you realize there is no reason to go weird with arrow operators when String is an object: var input = "Some kind of string."; var output = input.trim() .replace(' ', '-') .replaceAll("[./…]", "") .toLowerCase(); It looks like they solved the wrong issue but that is probably just side effect of using trivial examples.
- rafark 11mo agoYour second option was rejected years ago I believe. The pipes were designed to work alongside this rfc that was supposed to be in this new version (8.5) but due to time constraints it had to be delayed and it’s currently being voted https://wiki.php.net/rfc/partial_function_application_v2 https://wiki.php.net/rfc/partial_function_application_v2
- darkamaul 11mo agoPHP's evolution since PHP 5 has been substantial, and I think this is a real problem. As someone who learned the language years ago, the pace of change (generics, attributes, match expressions, typed properties) makes modern codebases genuinely difficult to follow. I suspect this affects many developers who cut their teeth on PHP but haven't kept up. The language has become a different beast, which is a strength for the community but a barrier to re-entry.
- phplovesong 11mo agoPHP has no generics? I read somewhere that is was "too hard" to get right in PHP land, mostly because of how primitive the typesystem is.
- dreadnip 11mo agoIf you're interested about generics in PHP, you can read this blog post by the PHP foundation: https://thephp.foundation/blog/2024/08/19/state-of-generics-and-collections/ https://thephp.foundation/blog/2024/08/19/state-of-generics-... or this PR by Nikita: https://github.com/PHPGenerics/php-generics-rfc/issues/45 https://github.com/PHPGenerics/php-generics-rfc/issues/45. TLDR: The PHP compiler isn't really suited for the job, it would introduce a lot of complexity to an already complex codebase and the memory/performance hit would be substantial.
- phplovesong 11mo agoYup, this was pretty much what i recalled. The typesystem, while being incredibly "unintelligent", somehow still is so complex that generics are not going to happen.
- deaddodo 11mo agoIt has nothing to do with being “too hard”, and everything to do with not making sense to the type system. PHP is weakly-typed and heavily reflection-based (so everything is aware of it’s and each other’s type at all times). Adding generics to PHP would make CS fundamentalists somewhat happy, but do nothing to change the fundamental design of PHP nor offer any of the traditional benefits that generics offer to strongly-typed and compiled languages. And would be a massive headache to implement, while bulking an already heavy VM implementation.
- habibur 11mo agoBackticks as an alias for shell_exec() are deprecated Used that a lot in shell scripts. using php-cli. like in `mkdir $dirname`;
- pabs3 11mo agoThat is an anti-pattern, since it suffers from shell meta-character injection (and argument injection). Since PHP has mkdir, you should use that instead. And pcntl_exec() is the correct API for running processes.
- dgb23 11mo agoTypical users of this likely don't care the slightest about whether anyone considers it an anti-pattern, because you use those in order to write utility scripts. And those who care would use tooling to detect issues like that anyways.
- pabs3 11mo agoYeah, doing things wrong happens quite often. Especially for the meta-character injection issue. Personally I think language designers should deprecate and remove backticks and other shell-executing features from all languages.
- inovica 11mo agoI still love PHP. 23 years ago we created some encryption software for it and it is still going. I also run a PHP newsletter. There's still a strong community of people and whilst there are other languages which I also use (Python, Node.js) I still find myself gravitating towards PHP for fast and simple work The only issues I have. is that this is a 'double edged sword' in that PHP has become far more complex since the launch of PHP 5 and so it isn't as easy to understand from scratch as it used to be
- dijit 11mo ago> 23 years ago we created some encryption software for it ZEND? I remember "nulling" software in the mid-00's and Zend was always a terrible ball-ache. Which, if that was your project, is high praise. :)
- johnisgood 11mo agoI think PHP 8 is easy to understand if you write it from scratch, you just have to learn doing things the right way, read up on PSRs and so on. It is a bit more complex but much more secure and supports quite a lot of things now that are definitely helpful to have.
- matula 11mo agoI've seen a few other comments also talk about PHP becoming more complex. However, I have "simple" code built using 5.3 and it works perfectly fine in 8. So I guess it CAN be complex, but doesn't really need to be. The biggest changes I would make to that code are fixing the multiple 'switch' and 'if/else' blocks to an anonymous function or some mapping... but it's not required.
- jaredklewis 11mo agoThis is true. As long as only one person interacts with the code, all languages can be simple. C++ can be simple. But once multiple people are involved and I have to read someone else's code, then I really start to appreciate languages with less features. There are some language I love to write code in, like Ruby or Haskell, where I feel like a damn genius when I write it, but want to pull my hair out when I have to read someone else's code.
- nalekberov 11mo agoThanks PHP for bringing pipe operator in 2025.
- phplovesong 11mo agoPHP should REALLY focus on getting the core stuff in shape. Its still so annoying that you have to use mb_real_uppercase($name) for unicode. The other gripe is that the stdlib is SO messy. With PHP 5.3 they had a once in a lifetime opportunity to cleanup the stdlib and introduce a new namespaced API for builtins, and optionally introduce a uniform function call syntax: "foo"->strtoupper(); Whenever doing PHP the time for concurrency will come sooner or later. Having no way of doing ANY concurrency is a letdown. The Fiber API does nothing on its own, and you are forced to use some third party runtime, that is usually a non-starter for legacy projects. PHP has come a long way from the PHP 4.0 era, but is still lacking in multiple areas, and i dont see it being a pick for greenfield projects in 2025.
- senfiaj 11mo agoYeah, the core ergonomics is significantly lagging behind most other backend languages despite improvements in some areas. I even wrote an article https://waspdev.com/articles/2025-06-12/my-honest-opinion-about-php https://waspdev.com/articles/2025-06-12/my-honest-opinion-ab... . As for concurrency/async, it's possible to do requests in parallel with curl_multi_*. Other async/prallel things are also possible, but tend to be more complicated compared to JS or other languages with promise and async support.
- spiderfarmer 11mo ago> i dont see it being a pick for greenfield projects in 2025 You don't see it because you're not looking. There are many Laravel jobs in my area. If you think that is only for Legacy projects, might be mistaken.
- phplovesong 11mo agoJust looked at Laravel, and it feels like its trying its hardest to lipstick the PHP warts. When i look at a framework like it i see just bloat. You really only need like 5-10% of stuff thats there. Thats why its most likely slow and heavy, and looks like it was cowboy copied from some legacy .NET enterprisey framework from the early 2010s. Jobs? Sure. There are PHP jobs, and the PHP devs are a dime a dozen. But i will agree with you, Laravel is a fine pick for websites, but not so much for more real world, high load applications. Theres also 100x more jobs for WordPress than Laravel, so if you want to do PHP, i suggest going the WordPress route instead.
- holoduke 11mo agoWhy is it that all these languages like PHP, but also typescript are becoming like impossible puzzles to read. I find these generics, types and other language features very often causing complex software architecture. I see so many collegues these days struggling in understanding codebases. You almost need a PHD brain to be a frontend web developer.
- onli 11mo agoI assume it is some inferiority complex, on many sides. PHP itself was laughed at being too simple, underpowered and inconsistent, now they overcorrected with types, annotations and breaking backwards compatibility with every release so that no old code base can remain intact. Frontend devs yearned to be regarded as real developers, which in their context means construction of unwieldly and overcomplex enterprise bullshit, thus typescript etc. And in the backend you have that same mechanism, devs having to prove they are no beginners and thus using (wrongly) design patterns, instructed by software architects, instead of avoiding abstraction and thus complexity. No, I'm not bitter.
- kreco 11mo agoLike on of my sibling comment, I truly believe this is connected to some degree of social pressure. People pointing fingers to "outdated" languages for not having some of the most trendy constructs. The pipe operator is definitely one of the feature that create more ways to do the same thing while providing unclear benefit. Never in my life I was in a situation like "with the pipe operator this I would have saved me hours of debugging/reading/creating code".
- squigz 11mo agoIt's somewhat comforting to read my insecurities shared by others in this thread
- niek_pas 11mo agoCan you share an example of what you're talking about in PHP 8.5? On the linked web page, the only code pattern that looks remotely complicated to me is the following: #[SkipDiscovery(static function (Container $container): bool { return ! $container->get(Application::class) instanceof ConsoleApplication; })] final class BlogPostEventHandlers { /\* … \*/ }
- nalekberov 11mo ago[flagged]
- mikedelfino 11mo agoWhat do you mean developers should deal with functions like those? They're used when necessary, yes, just like any function. And no IDE is required. I'm really puzzled.
- nalekberov 11mo ago> And no IDE is required. What else to say, good luck. You didn't get the anecdote, that's probably because you haven't worked with PHP (long enough). I will give hint: inconsistency.
- mikedelfino 11mo agoEither working with PHP for 21 years is not long enough or simply too long. I honestly think these small inconsistencies are irrelevant in the big picture of building something complex. Like you said, programmers should deal with them. It just doesn't sound like a big deal.
- nalekberov 11mo ago> I honestly think these small inconsistencies are irrelevant in the big picture of building something complex. Big picture is PHP is a poor tool. I enumerated only one annoyance about writing software on PHP, 80% of all websites on the web being built on it doesn't make it any better. Some companies keep building on it, because: 1. They started writing the codebase in PHP, now they are "locked" (cost of switching to another language is extremely high) 2. Hiring PHP developers usually costs a lot less (at least 20%) than say Java/Python developers People keep arguing that, for seasoned developers it doesn't matter what tool one chooses. Then what is the point of choosing a tool over another, if you gotta check the docs constantly for inconsistencies? (I'm sorry, you gotta use IDE anyways) With that said, there is no ideal language, however PHP is single most annoying language after JavaScript.
- petecooper 11mo agoOfficial release notes: https://www.php.net/releases/8.5/en.php https://www.php.net/releases/8.5/en.php
- xonre 11mo agoPHP should do a real major compatibility break and remove $ sigil from variable names. It's gonna be worth the pain!
- johannes1234321 11mo agoHello Perl 6! Such a change makes it a completely different language with no compatibility. Thus all previous code is lost, no easy migration paths (especially for libraries which would like to support both during transition)
- hu3 11mo agoI would love that. But yeah, it would probably kill PHP because it would break all code. Maybe https://getrector.com https://getrector.com could auto-fix 99% of code but it would still be very hard to get adoption.
- rafark 11mo agoWould it though? I’ve been thinking about this for a while. What about introducing a new file extension for this? Something like MyClass.p so that .php is for classic syntax and .p Can support newer syntax? You could support old codebases while at the same time support better syntax. It’s probably too much for the core php team to maintain both though
- theoldgreybeard 11mo agoCan’t believe we’re getting array_first, array_last and fatal error stack traces in PHP before GTA6.
- neor 11mo agoNice additions, but haven't really missed them a lot. Most of the time if I want the first or last element I don't care about the array itself so array_shift and array_pop work just fine.
- dgb23 11mo agoThe pipe operator example omits the typical way you would write this code in any language: simply by introducing temporary variables or by shadowing. The url parse example is not being compared to the builtin parse_url function that is just as easy to use.
- RobAley 11mo agoParse_url isn't standards compliant, often fails with relative url's and most importantly only parses urls, not uris (with the exception of file://). I also find it's syntax clunkier than the new uri(), but that's just personal preference. The pipe operator is indeed just syntactical sugar (and the article links to another article specifically about it which does cover the case of temporary variables), but with the coming partial function application feature it (in my opinion) will make easier to read/reason chains of code than temporary variables or nested function calls.
- duskwuff 11mo agoparse_url() also had no generate_url() counterpart - sure, it could (sometimes) split a URL into its components, but there was no safe way to modify those components and glue them back into a string. The new URI class solves that.
- fbn79 11mo agoarggg.... PHP introduce pipe operator before ecmascript. I want it in Javascript!
- ReptileMan 11mo agoOne of the things I have noticed in languages is that after some iterative evolution the piled on features and syntaxis sugar make them look bizarre and hard to read. Probably the weight of backwards compatibility and that the initial paradigms have picked up the easy to understand real estate. And there are no good ways of getting out of the corner you have coded yourself in. Probably because compile/interpret is one way street. There is no way to lets say view/transform a part of the code in functional or imperative depending on what you need to do with it. Reading modern php or even worse mixed generations code base feels like another full time job on top of the regular one - coding with it.
- yupyupyups 11mo agoIs PHP still unhelpful when it comes to writing secure code? I remember when escaping SQL input data was "the correct way" to use your mysql database. Parametrization? Nah, just use mysql_escape_string or whatever it was called.
- Octoth0rpe 11mo agophp has kept around a lot of functionality that can be misused, but PDO has had parameterization since forever and is the go to method if you want to connect to a database. Beyond that though, most PHP projects at this point are likely using a query builder/orm like eloquent. So I guess it depends on what you mean by unhelpful. PHP as a language makes it pretty easy to do bad stuff. PHP as a community makes it easy to Do The Right Thing.
- g105b 11mo agoSQL named parameters was a feature introduced into PHP on 24th Nov 2005, with the release of PHP 5.1.0.
- krapp 11mo agoPrepared statements have been available in PHP for over 20 years, when it deprecated the old mysql libraries. They were removed entirely in PHP 7. And let's be real - most handwritten SQL code in existence in most languages just builds queries from concatenated strings, even when more secure options exist. A lot of code doesn't even bother to escape anything. That's not a language problem so much as a developer laziness and assumption that "simplicity always equals correctness and frameworks are always wrong" problem.
- amiga-workbench 11mo agoYou use PDO and prepared statements. Although realistically, you are going to be using a framework and some kind of Active Record pattern.
- Ayesh 11mo agothe MySQL extension was dropped in PHP 7.0.
- icar 11mo agoDo people have any recommendations for modern PHP tutorials and learning sources?
- johnisgood 11mo agoYes, see: https://news.ycombinator.com/item?id=39989663 https://news.ycombinator.com/item?id=39989663 --- Books: * PHP & MySQL: Novice to Ninja by Tom Butler * PHP 8 - Quick Scripting Reference by Mikael Olsson * PHP 8 Objects, Patterns, and Practice by Matt Zandstra * Programming PHP (2020) by Kevin Tatroe and Peter MacIntyre I personally found them to be really good. I learned a lot from the first book especially. You can find the code from the first book here: https://github.com/spbooks/phpmysql7 https://github.com/spbooks/phpmysql7 I hope this helps.
- moebrowne 11mo agohttps://phptherightway.com/ https://phptherightway.com/ Is a good place to start
- browningstreet 11mo agoHas NativePHP gotten any legs?
- thefounder 11mo agoI think php should have stopped at php4 or php5 and maybe just develop a new/sane standard library. And a new language could have been developed , call it hack or whatever Facebook tried. Anyway I remember php coding gave me headaches. Tried it again 2 years ago and found out the same kind of issues(outdated /inexistent documentation, different ways to do the same thing that actually didn’t work and stuff like that). Try to connect to sql database using ssl and see what I mean. I see no reason to learn PHP anymore or start up your company using php. We live in a vps/docker age. The advantage of php hosts everywhere has been lost.
- hu3 11mo agoWithout specifics it's hard to understand what kind of difficulties you had. But PHP is still so strong because it offers much more than "easy hosting". What I personaly love most is the instant save file->see results feedback loop. There's no perceptible compilation step. Meanwhile my Java project takes a minute to compile. Also the shared-nothing model by default is powerful and rare. Laravel is probably the most well documented frameworks even comparing frameworks from other languages. And symfony, also a PHP framework, is not far from that. When you say "SSL" I can only think your reasoning is based on outdated information since no one calls it SSL anymore. It's TLS for some years now. And I have been connecting to databases using PHP TLS/SSL since version 5. For almost a decade now.
- idoubtit 11mo agoAdding new functions and alternative syntax has a long-term cost for PHP and the projects that use the language. I don't see much value in the new features of PHP5 announced on https://www.php.net/releases/8.5/en.php https://www.php.net/releases/8.5/en.php - URI extension: there was already the internal `parse_url()` which was imperfect, and alternative libraries that were RFC 3986 compliant. An official extension will bring speed, but now there will be 2 official ways to parse URLs. - The pipe operator is a matter of taste. In the release notes, the new code is more verbose, because it defines anonymous functions. This alternative syntax means keeping a consistent code style will be harder. - The update of "clone" replaces 2 lines of code in some cases. Unless I misunderstood, it's a very minor change. - The #Discard/void will replace the similar feature from static analyzers. - Closures in constants is one of the 2 features that bring more than an alternative syntax. It's one more little step toward a preprocessor. But I'm not thrilled about the future #attributes assigned with complex closures. - cURL persistent handles are a real performance feature, because curl_init() is costly. - array_first() is a minor syntax-sugar. In a project of 100k+ lines of PHP, I probably could use it twice or thrice. Was it worth a global function?
- dzonga 11mo agoif they was something to learn it was for the Ruby community to learn from the PHP community on how to reinvent itself. PHP like Ruby had some big companies built on it - Facebook: PHP, Ruby: Github/Shopify PHP was able to swallow Hack and become PHP8 - they optimized for getting beginners into the language / ecosystem Ruby while a beautiful / friendly language and ecosystem - got into political wars - didn't optimize for beginners on windows etc even as a person who favors Rails - Laravel is ahead -> on documentation & bringing various ways to do things into the framework. There's no stick with Hotwire. You wanna do livewire go ahead, we will help you. You wanna do Inertia + JS - go ahead we will help you.
- dr0verride 10mo agoPHP is still an incredibly verbose and tedious language to work with. I'm glad that it's continuing to improve because I'm stuck with it everyday.