9 ms·
PHP 8.3
- jbirer 3y agoRecently got a freelance Wordpress job after like 10 years of inactivity in that segment, I was surprised by how good PHP has become. I am hoping that it'll continue in this direction.
- oraetlabora 3y agoIt better be. 77% of websites use PHP.
- loloquwowndueo 3y agoNetcraft confirms it?
- trey-jones 3y agoNo doubt 25% of those are still on PHP 5.6 or older.
- npsomaratna 3y agoI've used PHP since the early 2000's (I started with PHP 4, I think). The language has improved vastly since then. When combined with the Laravel framework, you've got a first-class platform for building web applications.
- wouldbecouldbe 3y agoThe point of php was to not be ”good”, but to be practical. A simple way to add some logic to html. Write a few lines, upload it, boom it works. Quick and easy. There is a place for typed & strict languages and a place for pragmatic ones. But php got shamed for it so badly they got into an identity crisis, for the last decade it’s slowly been trying to become Java and do everything correct. Same with Wordpress, before I could just make a plug-in with one php file & a few lines. Now I have to create a separate npm project and build for every tiny change
- Timon3 3y agoPHP got shamed for these things because people built complex, and over time unmaintainable, systems in it. Mind you, the "old ways" still work - you can still write a few lines, upload it, boom it works. Projects around PHP might have developed different ways of working, but that's because of problems in the old way - and that's not a fault of PHP, it's a plus that things move in a more maintainable and type-safe direction. You even reap some benefits when doing a "write a few lines, upload it, boom it works" workflow.
- wouldbecouldbe 3y agoYeah it's great that it still works, and should! That's not to say PHP isn't been overcomplicating itself & hasn't fully embraced why it's so succesfull and improved that part: it's easy & practical. How can it be even easier? For instance even simpler hosting? With things like vercel, and app engine PHP isn't necessarily the simplest choice in hosting sites anymore. A Vercel for PHP would be awesome.
- Timon3 3y ago> That's not to say PHP isn't been overcomplicating itself & hasn't fully embraced why it's so succesfull and improved that part: it's easy & practical. Do you have specific examples for things where PHP has been overcomplicating itself? Most complex things seem to actually make things easier for newbies (e.g. typing can be a great help).
- tommek4077 3y agoAnd as a legacy dev you can just ignore all of those new things. You do not have to use lavarel or any of the latest, greatest frameworks or features. Your code from 15years ago will just work as well.
- delfinom 3y ago>PHP got shamed for these things because people built complex, and over time unmaintainable, systems in it. Because it was very accessible for people to get into it without being you know, a 10 year programming veteran at least. Now all those newbies are out creating 400 npm dependency projects heh
- mschuster91 3y agoAt that point, I ask myself whether it's possible to interface strongly-typed PHP with Java. Like, either a PHP frontend for JVMs (just like Kotlin and whatnot), or run Java code inside PHP in a run-and-throw-away model. Almost everything but async/threads that I use in Java stuff has an 1:1 mapping.
- janosdebugs 3y agoSeveral years ago I worked on an interop project with Quercus, not sure if that project is still alive and tracking the changes.
- djxfade 3y agoNot sure about Java, but PHP does support FFI and can interface with C applications.
- blowski 3y agoIn theory, it sounds pretty interesting. PHP's ethos is quite different though - e.g. PHP's "arrays for everything" vs Java's "specific types for every case". Also, the absence of generics in PHP is a huge difference.
- mschuster91 3y agoAt least the PHP-in-JVM side shouldn't be that complex to do then... a LinkedList<Object> should be enough to match PHP arrays functionally. The largest challenge in a PHP-in-JVM project probably would be re-implementing its large stdlib as a wrapper around native Java.
- actionfromafar 3y agoOr, don't: as in compile PHP library to JVM. Something like https://github.com/mridoni/llxvm https://github.com/mridoni/llxvm
- DarkNova6 3y ago> PHP's "arrays for everything" I think that's more a framework/library philosophy than anything else. When I dabbled with PHP + symfony, I worked with some of the most clean APIs I've seen to this date.
- volkadav 3y ago"taerDown" good to see that php's upholding the tradition of putting the K in Quality ;)
- egeozcan 3y agoPHP was, and perhaps still is despite stiff competition from frameworks like Next.js, the ultimate backend-for-frontend (BFF) solution. It's a server-side, super-flexible layer ideal for connecting various components and delivering static HTML with JavaScript enhancements. While there's nothing inherently wrong with using PHP for tasks Java already handles well, given Java's proficiency in its domain, it's not always necessary to replicate these functions in PHP. However, there's a tendency to undervalue PHP-based applications, often labeled as 'home.php-style' apps. It's true they can become unwieldy and unmaintainable if not properly managed. Adhering to good practices is essential, but it's also important to remember not every project needs a complex solution like bootstrapping a Laravel project for a simple task list. Everything comes with its own set of trade-offs!
- troupo 3y ago> PHP was, and perhaps still is despite stiff competition from frameworks like Next.js, the ultimate backend-for-frontend (BFF) solution. I think Elixir with Phoenix and LiveView can give PHP a run for its money. But PHP is a beast.
- DarkNova6 3y agoI think it just boils down to your dev pool. If you already have Java devs, why bother establishing PHP as a new language in your company? Certainly, you can't justify paying them less than your Java devs... Let's face it, a major advantage of PHP nobody talks about is that devs are cheaper. I don't mean this all in a bad way, I have seen PHP used in high quality code-bases for websites of medium sized companies. But you are limited to input/output operations. However, there is also an advantage to this, as the PHP devs I have seen are more prone to trying out new tools and not reinvent the wheel in source code. Also, I want to shout out to the guys making Sulu CRM. Loved working with it, too bad it's PHP and symfony only.
- sshine 3y ago> the PHP devs I have seen are more prone to [...] not reinvent the wheel in source code* I have the opposite experience: Because PHP and package management is relatively new (Composer is from 2012, compared to CPAN's general availability in 1995), I haven't seen more wheel-reinventing than among PHP programmers. Even the standard library seems to be reinventing its own wheels. I'm looking at you, mysql_real*_escape_string.
- deleted 3y ago[deleted]
- diath 3y agoWhy the slash backward slash for override?
- askonomm 3y agoIt indicates the namespace where Override exists, which in this case is root level. \Namespace\Class is how namespaces in PHP work. If no \ is specified, it assumes Override is in the same namespace as the class it is being used in, and it would thus fail because it isn't.
- oddevan 3y agoIf you're using it a lot, you can add a `use` declaration up top: <?php use Override; //... #[Override] public function overridenParentFunction(string $stuff) //...
- phplovesong 3y agosooo many better alternatives to PHP in 2023.
- rawoke083600 3y agoBetter how ?
- phplovesong 3y agoIn almost any way. Sane data structures, a coherent namespaced stdlib etc etc. Like just how painful is it to do websockets in PHP? It requires all sorts of dependencies etc. PHP is just a mess with some lipstick, and to be honest it looks like they want PHP to be a Java clone.
- yett 3y agoPhplovesong doesn't love php anymore?
- nilslindemann 3y agoEasier to install.
- phatskat 3y agoCurious to hear about what some of your picks are, always good to see alternatives offered
- sshine 3y agoPerl.
- xhkkffbf 3y agoHow big are the performance gains? I've got a big block of legacy code so I'm not as interested in the new coding features. But if it brings better performance I'll install it.
- phatskat 3y agoIirc PHP >= 7 brought huge performance gains out of the box, and for those that really need it you can do additional work like preloading static files (but that’s likely beyond your scope).
- shortsunblack 3y agoWe've seen real change in rhetoric in web space. It seems like PHP (through Laravel in particular) is so back into being vogue. And that brings me joy. HTMX, Laravel, Livewire, alphine.js are all the things that are what these insane JS SPA frameworks aren't. Simple and intuitive.
- HackerThemAll 3y agoPHP doesn't care about the young coders' vogues. Just like SQL doesn't care about the NoSQL crap. It's still here and is going to be for the next few generations.
- scop 3y agoI was giving the major FE frameworks an honest try until they all started to move to server components. Blackpill moment. “Wait a minute…rendering HTML on the server…I THINK I’VE DONE THIS BEFORE (with a lot less boilerplate insanity)”
- pier25 3y agoLivewire is amazing. I'm a JS guy and I'm convinced this way of orchestrating the UI from the server is really the future of full stack dev. At least to solve 80-90% of use cases. There are still some situations that require client side components with APIs but it's really a minority. Doesn't make sense to focus all your efforts into a complex solution that is appropriate for a minority of use cases.
- enterprise_cog 3y agoOnly ever seen it praised in these threads specifically about PHP on HN. Where everyone who uses it says how amazing it is, and oddly enough, has no negatives to talk about.
- shortsunblack 3y agoPHP doesn't have many negatives. Even the go-to negatives aren't really. Many cite "rebuilding the environment everytime" as a con, but it's a pro in terms of horizontal scaling/load balancing. I for one would like PHP to have generics. It doesn't have that and plausibly will never have it (without a superset like TypeScript for JS).
- ransom1538 3y agoI coded php for years. Generally speaking, php teams (using smarty + composer) are faster. They don't have the ci/cd drama of java. PHP is made for the internet (unlike python) and is fast (unlike rails). It also doesn't suffer version drama (python2 vs python3).
- behnamoh 3y agophp doesn’t suffer from version drama??!
- gog 3y agoNot really, take a look at PHP version usage over time in this graph https://packagist.org/php-statistics https://packagist.org/php-statistics
- kyriakos 3y agoVery few breaking changes between releases helps a lot.
- ransom1538 3y agoYeah not at all. Try taking a python2 app then upgrade it to python3.
- nilslindemann 3y agoAny Python web framework is easier to install and start than PHP alone.
- mrcino 3y agoIs it backward compatible?
- gog 3y agoYes
- idoubtit 3y agoAlmost. Please read the section named "Deprecations and backward compatibility breaks" at the bottom of the post.
- dylan604 3y agoWith what? 8.2? 7.0? 5.4? you're going to get a mix of yes and no depending on what you're trying to do. lots of things have been deprecated over the years.
- Freaky 3y agoLooks like my fix for CPU feature detection under clang made it in, so such builds should now have much faster addslashes/base64/etc. They're still disabled by default on FreeBSD - my PR is pending, and the patch has been in testing in ports for a while: https://github.com/php/php-src/pull/12288 https://github.com/php/php-src/pull/12288
- plz-remove-card 3y agoI started using PHP for work back in the PHP 4 days when I started my career. As I grew in my abilities, appreciation for more advanced OOP concepts, and stricter typing, so did PHP, we kind of evolved together over the years. However, I'd be hard pressed to choose PHP for a green field project today. I wonder if I'd have just started off immediately using something like Java if I would have been as effective? Early PHP's sloppiness (paired with early javascript) gave me a lot of flexibility and allowed me to learn things more deeply.
- askonomm 3y agoI do lots of greenfield PHP these days, and honestly I don't see why people would not consider it. It's an extremely pragmatic language and ecosystem to ship things with. By the time I set up a Java project, I'd already have a WIP made with PHP. Modern PHP is strictly typed as well, and actually quite similar to Java, except much faster to actually make things with.
- phatskat 3y agoI started around PHP 4 as well, mostly as a hobby, and I think 5 was around the corner when I started really working in the field. I’d take PHP for a new project in a heartbeat if the shoe fit. My last real PHP project was Laravel+Inertia+Vue and it was a really great workflow for me and my team.
- ulrischa 3y agoPHP is so great. And there are many libraries that go far beyond just websites. What I miss are sole good libraries for NLP - especially for more languages than English. Or do I just don't know them?
- nilslindemann 3y agoPython: preinstalled. Node: downloadable binaries, edit .bashrc. Rust, Nim, Deno: bash one-liner to install, edit .bashrc. PHP: Nine pages of super complex installing instructions.
- tommek4077 3y agoOn a C64?
- nilslindemann 3y agoPHP still supports C64's?
- kyriakos 3y agoSingle command on Linux+wsl2, downloadable binaries on Windows. Official docker images on dockerhub. Not sure where you saw those 9 pages
- nilslindemann 3y ago> wsl2 Yeah, great. Now I have two problems. > downloadable binaries on Windows I am on Linux. > Official docker images on dockerhub Yeah, great. Now I have two problems. > Not sure where you saw those 9 pages In the official documentation, https://www.php.net/manual/en/install.unix.php https://www.php.net/manual/en/install.unix.php
- askonomm 3y agoapt-get install php