42 ms·
A look at modern PHP
- zerm778 7y agoPHP hater sheeps incoming
- gear54rus 7y agoI mean the obvious joke here is that it took 7 major versions over dozen of years to show its maturity :)
- PopeDotNinja 7y agoSounds like my life story.
- pietrovismara 7y agoFor me it's too late. I used PHP when it wasn't "mature" yet and hated it. There something blocking me now from ever going back to check it, no matter what its new features might be.
- jamil7 7y agoI cut my teeth on it years ago, I don't hate on it for cheap jokes. That said I don't know why anyone would pick it to start a new project in 2020. We've been lucky to have so many new and established options that are better in almost everyway.
- currriuosly 7y agoJust came here to say this.
- andrewjmg 7y ago"so many new and established options that are better in almost everyway" such as?
- manigandham 7y agoC# (optionally using the ASP.NET framework) running on the fast, efficient, cross-platform .NET Core. Or Java/Scala/Kotlin. Or Go. Or Python. Or Node + Typescript.
- Okawari 7y agoIf my project is "big enough" to warrant something like Laravel, I would just pick Rails or Phoenix over it any day. I find both those languages much better to work in and I just feel like I'm getting things done way faster. If its smaller than that, I'dd definitly just pick go or node with express or go maybe. I work with PHP 5 days a week through work and even a few years into it, i still do not like it. Its feels like a mess compared to the other languages I work with for my own projects. Even when working with something like Laravel which do mask a bunch of the pain points of the language, it still feels cumbersome IMO.
- andrewjmg 7y agowell, that's your biggest problem. PHP 5 is a steaming pile of dung when compared to PHP 7.
- p4bl0 7y agoI think it depends on the types of project or the target of the said project. Recently I had to develop a very small CMS that manages personal web pages and it was a requirement that it could be installed very easily (i.e., by copying a single file) on virtually any hosting provider. PHP was (and is) still the natural candidate for such projects.
- tsukurimashou 7y agoyou can run PHP pretty much anywhere, even the cheapest VPS probably has PHP, as well as all managed hosting. For python, go or other languages it can be more tricky if you're looking for cheap hosting / VPS
- manigandham 7y agoWith docker containers and the numerous PaaS/FaaS runtimes, does that really matter? You can run anything just about anywhere these days, cheaply or even for free.
- 1bc29b36f623ba8 7y agoFor us techies, no, it doesn't really matter. For average business owners who buy a WordPress template and some 5€ hosting in order to set up a business card web site on their own, on the other hand, it matters a lot. So if your project targets that group of people then PHP is pretty much the only option; anything more complicated than an FTP upload/MySQL import is pretty much to advanced for them and they generally aren't interested in learning new skills just to get a web site online.
- manigandham 7y agoWho's doing that anymore? Either you (or your staff) are technical enough to manage installing a web framework on a server, or you use any of the numerous managed sites instead. (Squarespace, Wix, Webflow, Wordpress.com, Shopify, Facebook, etc) The last thing a non-techie business owner needs is to worry about setting up a random server with bad PHP code.
- 1bc29b36f623ba8 6y agoThere's plenty of businesses selling business card web sites built on WordPress. They usually install it on whatever hosting the customer orders and then leaves the rest up to the customer.
- 7y ago
- melicerte 7y agoIt did not took long...
- deleted 7y ago[deleted]
- tommica 7y agoI've worked with PHP since 5.4, and to me the language has not been the obstacle, it has been my own skill-level that has held me back, and still is - I lack very much the core architectural skills in getting forward as a developer, among many other things. I've seen some codebases using an even older version, and I think I can understand where people are coming from with their angst towards the language - but I think we should look at ourselves before we jump to the bandvagon of just hating something blindly - I remember being part of the "Apple sucks" group for no other reason than hype, and now I've used one for years as a work machine.
- currriuosly 7y agoGood, that you can confirm your skill level, so maybe PHP suites you very well. For me, having no standard HashMap and having to set strict mode params in functions - is an instant no go. There is no lack of better options.
- tommica 7y ago> Good, that you can confirm your skill level, so maybe PHP suites you very well. Could you elaborate on this one, I am not exactly sure what you mean by it.
- Cthulhu_ 7y agoThis has been my experience too. Ten+ years ago I had already concluded that the biggest problem PHP has is the community. Googling for "php mysql" you still end up on w3schools and the like where SQL injection is still not emphasized. Everyone was making their own frameworks and software from scratch. My last foray into PHP, and my realization that it's not actually all bad, was working in Zend Framework (iirc this was also when Ruby on Rails was fairly new and gaining popularity fast). I haven't touched it (beyond very basic edits on my website, wordpress etc) for over a decade, but recently I inherited an older codebase at my new job. The existing codebase is an absolute mess, worse than the shit posted in those tutorials I mentioned. But as part of the job (beyond rebuilding the application), I also had to add a big new feature to the application, a REST API. Keep in mind that due to constraints on the systems we install on, it had to be made in PHP 5.2 or 5.3 - one difference being that the older version doesn't even support an array creation shorthand (`$var = []`). I could keep interactions with the existing codebase to a minimum. The rest was... actually surprisingly all right, thanks to me knowing what a REST API is and how to structure an application properly. I did have to basically write my own framework (sigh) because pretty much nothing is still available that works on pre-array-shorthand-versions of PHP, but it was fairly minimal; an off-the-shelf router and URL matcher (can't be arsed with writing that myself), middleware for authentication, and a simple class structure to encapsulate different output formats (json, csv, streaming plain text). Granted, this old version of PHP is seriously rough around the edges, and at the time it already represented great advancements in the language. I mean before 5.4 the language didn't even have a function to set the HTTP response code (you had to write the header manually).
- alphadevx 7y agoMany of the features highlighted in that article as "new" are from PHP 5.x, so it reads more like a list written by someone who has been out of touch with PHP development for a number of years.
- laumars 7y agoDid you actually read the article or just the headings? Any features that pre-date 7.x are discussed as being 5.x features and, where applicable, the author expands on how it's been further refined / improved upon in 7.x releases
- alphadevx 7y agoYes I read it, why accuse me of not doing so? The main block of sample code is highlighting OOP features in PHP, but PHP has had most of those features since 5.3, e.g. namespaces, so my point still stands. Those features are not part of "PHP showing its maturity in release 7.4", but have been around since at least 2009, so why lead with that example?
- laumars 7y agoThe article says those features are from PHP 5: When objects were first introduced in PHP 4, the implementation was essentially an array with function references and was horribly problematic. The fundamental problems of that implementation were thankfully addressed with the release of PHP 5, featuring an entirely rethought object implementation. In the versions that have come since, up through version the current 7.4 releases, numerous interesting language features for object-oriented programming (OOP) have emerged. I suspect you're narrowing the scope of what this article was intended to cover. It is not just a look at PHP 7.4; it's just using the recent PHP release as an excuse for a look back at the history of the language: With PHP 7.4.5 released in April, it's worthwhile to take a look at modern PHP, how it has evolved to address the criticisms of the past, and what lies ahead in its future.
- alphadevx 7y ago
- Svip 7y agoEven with PHP7, PHP still feels like it is playing catch up. There is nothing new or revolutionary in PHP7, just adopting features present in other major languages. Adopting as other newer languages like Go and Rust seems to be moving beyond those features. A catch up into a world that's on its way out, if one will feel so blunt. PHP's raison d'être remains its ease of getting an instance running on a webserver. But with fewer people self-hosting these days, that has become less an advantage. And even for those who do self-host, the advantage is becoming narrower as other languages have made it easier to distribute their web applications. Pascal, COBOL, Oracle DB and PHP today seems like technologies that only stick around because they are legacies being maintained, not because people start new grand projects with them. Would Wordpress have chosen PHP if they started today?
- cbg0 7y ago> Would Wordpress have chosen PHP if they started today? You could replace "Wordpress" and "PHP" with whatever you want, depending at which point in history this comment is made.
- enitihas 7y agoKubernetes and go for example.
- Tomte 7y ago> There is nothing new or revolutionary in PHP7, just adopting features present in other major languages. There is nothing wrong with that. Java also follows that philosophy. > Would Wordpress have chosen PHP if they started today? According to Matt Mullenweg: no, but does it matter? People do start new PHP projects, and people use old, but still maintained PHP projects. If you're looking for shiny new things, look elsewhere. But you don't have to take away the working, well-known "old" away from others.
- simion314 7y agoMost of the time you do not chose a language or ecosystem because it has some cool syntax or some new feature. As an example if you need to do X you look at what solves X the best, if I can do X by installing say ffmpeg and write a bash script I will do that and not cry that bash does not have some cool feature. I think languages like PHP, Java, C++ appeal for people that solve hard problem where the fact that you have a giant ecosystem of existing libraries and a large number of existing developers compensates the fact that the language is not "cool" or is missing some feature that you probably don't need anyway or workaround it with a library.
- echelon 7y agoFor web backend, being able to ship a single binary, such as what Rust and Go can provide, is really nice. I don't see PHP as a more compelling solution than either of those languages. Scripting and command line automation is executed better by Python and Ruby, which excel for writing Unix scripts and tools. I do not see what the use case for PHP is in 2020. PHP has one of the most abhorrent language syntax designs this side of Perl, and the standard library is wildly inconsistent. I really wish PHP would just die. Continuing to drag it along like the dead carcass it is wastes so much human effort. The longer it exists, the longer we have to support it.
- Cthulhu_ 7y agoAt the same time, being able to install new or change existing software just by uploading some files to a cheap webhost is not to be dismissed as easily.
- pm90 7y agoMost webhosts provide some kind of support for containers don’t they? Perhaps I’m completely missing the point here? I’ll readily admit that Im young enough to have used docker to deploy apps nearly everywhere I worked. Is php useful for ultra low cost websites? Is it low maintenance? Is that the appeal? Genuine question.
- bzb3 7y agoDropping PHP files to a FTP site is as easy as it gets.
- echelon 7y agoThat's an incredibly process-immature way of managing deployment. How do you know what version you have deployed unless you copy everything you deploy to some archive somewhere? How do you roll back? How do you find out if you monkey-patched something? Deploying Docker images or static binaries is vastly superior and no more difficult. It's just a new paradigm.
- p4bl0 7y agoI very rarely write PHP and will probably never have to use these features, but I think that the combination of the FFI and preloading can be quite a powerful thing.
- thdrdt 7y agoI've been using PHP for over 15 years and always liked it. There is no other webserver language that's so easy to use and so deployable while still being fast. But for larger projects the available frameworks are just okayish. I think Symfony is closest to what a good framework should be. But every time I use it I wish it would be like .NET Today .NET core is also available on Linux and very easy to deploy so I don't think I will ever start a big project in PHP again. But for quick smaller and CMS[1] projects PHP is still my goto language. [1] If you are looking for a great PHP CMS: https://processwire.com/ https://processwire.com/
- toshk 7y agoI always enjoyed Laravel
- nsomaru 7y agoWhat if you’re looking for a great way into .net web dev on Linux? I’ve been struggling to find a good guide that combines dev env, deployment and a good web framework. Any advice? I have quite a bit of xp with Python (Django/flask) and less with php.
- oblio 7y agoAren't there guide for ASP.NET Core? https://docs.microsoft.com/en-us/aspnet/core/?view=aspnetcore-3.1 https://docs.microsoft.com/en-us/aspnet/core/?view=aspnetcor... I think you need VS Code with some extensions, .NET Core installed and you should be off to the races in half an hour.
- thdrdt 7y agoMaybe this is a good place to start: https://dotnet.microsoft.com/learn https://dotnet.microsoft.com/learn Most can be done via de command line but an editor like VisualStudioCode could be handy. Personally I use Jetbrain's Rider as IDE on Ubuntu. Deploying can be done via the `dotnet publish` command. But tools like Teamcity can also be very useful. When you built a webapp it includes the Kestrel webserver. So it is just a matter of running the app and navigating to the port it listens to. .NET core is a complete set of tools to create console apps, (web)APIs and webApps. This includes the .NET framework.
- perttir 7y agoI use php daily. Mostly Symfony/Laravel stuff. There are still some stuff it needs what other languages have. (Can't really right now remember all the stuff i stumble upon sometimes which gives me the feeling "damn if i could do this like i do it in rust/java/cpp/(w/e)") Maybe the worst thing is the composer (it's slow.)
- Eremotherium 7y agoTry Prestissimo, which enables composer to download packages in parallel composer global require hirak/prestissimo
- pachico 7y agoI have been coding in PHP for 15 years (not exclusively) and indeed many things had to improve. Nevertheless, many other languages also had to. Just as an example, PHP had a much more mature vendor requirements system than Go and years before! What I see many people tend to fail to observe is that a language is also good as the amount of value it can being to the business and in that PHP was and still is phenomenal. Anyhow, I'm really happy to see how it has evolved.
- sneak 7y agoI wrote my very first webapp in PHP when I was a teenager, and my first dozen paid apps shortly thereafter as a consultant. PHP was a lot worse then, but still has a lot of the same fundamental issues that it won’t ever be able to escape without becoming a different language. I think it’s a good first tinkering language for people around that age: sort of like BASIC, but for the web. I am glad PHP is still around; it is a very useful signal on the resume or CV of someone who uses it a lot. It’s sort of like c# in that regard (exception granted for vertical-specific devs who work professionally to ship commercial apps with Unity), or Visual Basic before it. Same goes for heavy Java outside of Google/Amazon backend, or outside of Android. Most of these people are desktop Windows users by choice, too. It’s a very specific type of techie. Perhaps one day I should make an ishkur-style taxonomy. :D I think this is also why almost all forum software is written in PHP.
- ur-whale 7y agoDoes php still use $ for variable names in 2020?
- fetbaffe 7y agoOf course. Why change that for zero gain? Powershell does too. Can you point to some research that scientifically proves that the use of dollar sign in variable names makes it harder to solve computer science problems?
- ur-whale 7y ago1. Waste of time and mental cycles: forces the programmer to do the parser's job because the language designer was too lazy to build in the logic to recognize variables. 2. Carpal tunnel syndrome, especially on keyboards where "$" can only be reached via shift.
- fetbaffe 7y ago1. Personally I find it easier to read variable names prefixed with dollar signs, it differentiates variables from other symbols, which makes them very easy to find, especially now when many languages gives information overload by lots of type information etc. My eyes can scan code faster. 2. rebind your keyboard.
- open-source-ux 7y agoWhether you like or hate PHP, it has achieved something that no other language has done - made it easy to host a dynamic website or app on the server. Other languages may claim to be 'web-friendly' (e.g. Python, Ruby) but when it comes to ease of deployment, they are anything but 'web-friendly' or easy. This is what programmer and blogger Jeff Atwood - who isn't a fan of PHP - has written about PHP: "If you want to produce free-as-in-whatever code that runs on virtually every server in the world with zero friction or configuration hassles, PHP is damn near your only option" He wrote that in 2012. It's 2020 and I can't think of any other language that has caught up with PHP's ease of deployment. If you want to get your customers to self-install your software as painlessly as possible, what other language can match or exceed the ease of deployment of PHP?
- realharo 7y ago>If you want to get your customers to self-install your software as painlessly as possible, what other language can match or exceed the ease of deployment of PHP? Anything with containers. Docker was a real game-changer here.
- barbegal 7y agoBut in the overall scheme of things it's order of magnitudes more difficult to deploy. PHP is upload a file whereas docker requires many more steps (for example: https://kb.sloppy.io/en/collections/156106-getting-started https://kb.sloppy.io/en/collections/156106-getting-started )
- realharo 7y agoThe first section in that link literally says >In our dashboard you will find pre-configured Open Source apps like WordPress, Plone and other. They are all based on the official docker images and can be deployed with just one click. Otherwise I don't see how something like this is that much more difficult https://www.openshift.com/blog/deploying-applications-from-images-in-openshift-part-one-web-console https://www.openshift.com/blog/deploying-applications-from-i... Or this https://kb.sloppy.io/en/articles/1313693-setting-up-mongodb-and-mongo-express-on-sloppy-io https://kb.sloppy.io/en/articles/1313693-setting-up-mongodb-...
- cageface 7y agoPHP, Python and Ruby all feel to me like last-generation languages. IMO we should be building new frameworks on modern languages that support concurrency & static typing. The most promising new stack I've seen is Kotlin's KTOR framework. Thanks to the expressiveness of Kotlin it's not really any more verbose than something like PHP or Ruby but it's far more powerful and robust.
- pojntfx 7y agoNah. The JVM must go; we have Docker and the universal platform are Linux ELF binaries so the entire "bytecode" concept makes sense for the compiler (i.e. LLVM), but no longer at runtime. It's just bloat.
- cageface 7y agoKotlin native might eventually make the JVM superfluous but for now there are a lot of benefits to being on the JVM including great performance, a huge ecosystem of Java libraries, and very battle hardened monitoring and debugging tools.
- hocuspocus 7y ago> Kotlin native might eventually make the JVM superfluous That is probably never going to happen. GraalVM native images are a more realistic approach in this space, and even that is not trivial in most cases.
- lmm 7y agoThe JVM does what Docker does for far less overhead and is easier to understand and upgrade.
- erik_seaberg 7y agoBytecode is simple enough to alter at load time. This gives you aspect-oriented programming and instrumentation of everything that statically linked binaries have never offered. And I don't think anything compares to the JVM's GC throughout yet; why roll your own if it's slow?
- jerng 7y agoMeanwhile JavaScript/ECMAScript's syntax creep is turning it into PHP.
- dastx 7y agoAnd their modules ecosystem is turning it into a security nightmare.
- riteshpatel 7y agoNoticed this recently when doing an ES6 course. So many additions look similar to modern PHP!
- Dylan16807 7y agoIf it's modern PHP specifically, are you saying that both languages are adding a bunch of the same things? That doesn't really sound like one language turning into the other.
- pojntfx 7y agoIf you're starting with WebDev in 2020, choose Go or Rust. Concurrency & safety + simple deployable static ELF binaries > weak typing and legacy bloat.
- The_Colonel 7y agorust has huge mental overhead for most webdev work go is incredibly weak language in some regards (error handling?) From these 3 I would still pick PHP for webdev.
- simion314 7y agoWhy would I use Rust for Web dev or anything else that is not some low level system programming? I mean if you want to write some toy project and want to learn sure, but for a serious project I would chose something that uses a higher level programming language, that has a big and stable standard library and that also has a big community made , well tested libraries to work with.
- dastx 7y ago> weak typing and legacy bloat Lots of legacy stuff has been removed. Static typing has been added as a feature back in PHP 7.0.
- valand 7y agoI love rust, it's great once you adapt to it, but I don't think it'll be anytime soon people would convert to Rust (although I wish they will). The paradigm and the workflow are alien to most, the discipline needed to write with it needs learning.
- Narann 7y agoDepicts language feature, PHP ecosystem is dying. For me, an example is latest MediaWiki syntax highlight extension dropped GeSHi (PHP) which is not updated anymore, to pygments (Python) using a sub process. I realized I have to drop MediaWiki because my host didn't expose PHP proc_open() feature. I don't even know where to start. A natively written syntax highlighter can be considered as an important brick in an ecosystem (GeSHi was used everywhere few years ago), but it looks like no-one is working on it anymore so MediaWiki did an strong technological move to use Python via a sub process. This kind of move (dropping a existing natively written tool for a tool from another language) shows how bad the ecosystem situation is.
- zozbot234 7y agoWould it be feasible to write a PHP equivalent to emscripten, so that one could export software compiled from any frontend language (including, e.g. the WASM representation) as a php object that can be run directly by mod_php?
- creshal 7y agoIt should be possible, but I'm not sure if PHP has the kind of community drive behind it to make it a realistic option. Or a necessary one – emscripten's main use case is "everyone has a browser", but there's very few PHP hosting offerings where you can't shell out and just run straight native code (in your own little isolated sandbox).
- zozbot234 7y ago> shell out and just run straight native code (in your own little isolated sandbox) Parent poster said that they couldn't do that on their host, though. Which breaks a MediaWiki feature (syntax highlighting for code blocks).
- dastx 7y agoThis is a side effect of open source. GeSHi, and many others, suddenly stop getting maintained, and more often than not, project ownership doesn't get passed down. This problem isn't unique to PHP. I have seen this is many projects across all kinds of different languages and tooling. Unfortunately, if there's no good alternative written in PHP, MediaWiki could have either reimplement it from scratch. In my opinion, GeSHi isn't the best implementation of a syntax highlighter, so I get their reason to not adopt it. Writing a syntax highlighter from scratch isn't a trivial task either. None of this says that the PHP ecosystem is dying though. MediaWiki isn't going to suddenly move away from PHP. Nor will many, many of the other big name projects that are still built on top PHP, and as long as there are big name projects, PHP ecosystem will continue to evolve. I will say choosing a Python sub-process at the sacrifice of portability (considering how many people simply run this on a PHP webhoster) is quite surprising.
- zabil 7y agoNever worked in PHP, but I watched this talk, "Let's program like it's 1999", about PHP's influence on JSX and React. I quite enjoyed the talk.
- xd 7y agoI've been using PHP professionally since ~1999. I remember ripping the Perl fanboys in the early 2000's until the foundations of PHP started to crumble with what are issues that stick in peoples minds today; so I do wonder if we brought it on ourselves sometimes. But PHP moved on carefully to preserve backwards compatibility. I still have a SaaS first developed back in 2005 on the latest version of PHP that's happily ticking over with the minimal of maintenance required - the code base is horrendous but that's because a developer I had with me at the time made a massive case for "software design patterns" that he crowbarred into every nook and cranny regardless of if it was required or not. I've done things with PHP that would give people nightmares. It's a far more capable language [1/2] than most realise and with version 8 bringing us JIT things just keep getting better. Would I use PHP if I was starting out today? Unlikely, but I know PHP inside out and can wield it to my wicked ends with ease so won't be dropping it anytime soon. [1] https://stitcher.io/blog/php-in-2019 https://stitcher.io/blog/php-in-2019 [2] https://stitcher.io/blog/php-in-2020 https://stitcher.io/blog/php-in-2020
- hnarn 7y ago> Would I use PHP if I was starting out today? Unlikely, but I know PHP inside out and can wield it to my wicked ends with ease so won't be dropping it anytime soon. So just out of curiosity, if you hypothetically did start learning web development today from scratch, what would you spend time learning instead of PHP?
- xd 7y agoWhen I started I struggled with browser inconsistencies. Over the years Javascript has come a long way and whilst I'm not 100% sold on node.js, I like the idea of using the same language across front and backend so likely would have gone down that road.
- jstummbillig 7y agoIf after 20 years of PHP experience you arrived at "not 100% sold on node.js" as your most likely alternative, that to me more than anything else signals a strong, ongoing vote for PHP :)
- hising 7y agoWhy do these discussions always end up in some black/white dicotomy? Are there situations where PHP is a valid part of a tech stack? Sure. Are there places where, if you could choose, PHP is not a good choice in the stack, Yup. My personal view of it is that it is part of our eco-system and will not go away, how eager some of us may be to have it disappear, so seeing it getting better as a platform should make the world a little better for a lot of people that need to use it in systems that are built with parts in PHP.I cant see how that is a bad thing. The thing I dont understand is, if you for some reason do not like to use a specific language or tech, why bother trying to convince others not to use it? Few of the people I worked with have only one tool in their belt, and they can work in any language. We all have some favorable setup that we think is best for us/others to use in order to build better software with quicker iterations. But all of us (hopefully) also know that few, if any, stacks are 100% solid and consistent after a couple of years. There is always some parts that we wish would not exist, some script that magically does stuff that we do not dare to touch, some service that is written in some fancy language by that awesome dev that worked here 10 years ago or some really central part of our software that is written in Python, talking to a module written in C that needs to be compiled with a specific compiler that went dead 4 years ago. Even if we dream about the perfect system that just works (LIKE I WANT IT) and has a fantastic setup, it is only at specific snapshots of time systems work like that. Time, people, organizations, product requirements, marketing efforts, buzz, hacks, fixes, playfulness, boredom etc all makes system degrade over time and while it is important to manage these debts, it is more or less impossible to have a system in a state where it will always have the tech stack you want right now. That way, we will always have to address bugs in PHP, old Python-versions, rage over custom compiled nginx or whatever. Whether or not PHP is a good language or not is a meta-discussion IMO. If languages that are used by a lot of people gets better over time, that is awesome in my book. Having a perfect tech stack with only funny/new/fancy/awesome tech is at best an interesting mind experiment.
- hnarn 7y agoAs soon as you hit a certain level of complexity in your solution/software/whatever, you will be using multiple languages. You'll have scripts written in Bash, front-ends using PHP, back-ends using C or whatever. You are definitely correct that there is no black and white here, all software just needs to be "good enough" to actually solve a problem and be worth paying for. If PHP being slow stops you from being "good enough" then it's very likely that you can just isolate the part where PHP isn't doing a good job, re-write that in another language and keep the parts where PHP is working fine.
- dep_b 7y agoTried PHP again (using it since the 3.x days off and on) a few years ago and didn't dislike it. It would be great if types were even better enforced. But then again I could have been working with Microsoft MVC instead and have an even better experience, especially in terms of autocomplete in an IDE (because C# has stronger types and they are more logical to find by trial and error, like typing a . after a string value), something which I highly value. But I still think PHP is really cool when you just want to hack something together and indeed like many people said before run it anywhere without headache. You can output formatted text really easily. Other languages are way more formal about output. I hacked together a song recommendation and voting system for my marriage website in a few hours and people loved it.
- 72deluxe 7y agoI still can't see how it can be "mature" if it offers an iterable returnable type like in the article example yet doesn't indicate the type of the object it is returning! It has type hints for function parameters and return types but not for arrays. This makes it useless to me. I know everybody will say "just add comments so an IDE can interpret it" but this should be a feature of the language. Just adding comments to hint to an IDE is not a real solution. It's still just a vector<void* > in C++ parlance. Nobody would take you seriously if you said "just add comments to indicate what your void* might be" in a large codebase.
- mrkeen 7y agoI still can't see how C++ can be "mature" if you have to indicate the type of object it is returning! I know everybody will say "just add a type declaration so the compiler can interpret it" but this should be a feature of the language. Just adding type declarations to hint to a compiler is not a real solution.
- 72deluxe 7y agoBut it's not a hint to the compiler. It's stating a fact to the compiler. It'll stop compilation. If I have a basket of fruit, all the items in that basket container are fruit. I can't put anything other than fruit in it. It's a basket of fruit. I know how to interact with the fruit due to its type. If I am able to put dung into my basket, my fruit is spoiled and I cannot assume how to interact with the objects in the basket. This is a PHP array without types at the array level. I can put dung into it and have no idea how to interact with it. Or are you saying that a container of any type is perfectly acceptable? Did the other languages (C++, C#, Java) get it wrong? eg. on this line can you tell me what the array holds and how I interact with it? What does array $operations hold? https://github.com/magento/magento2/blob/420a8b6209a4e62ede97bb66768cc904c936c941/app/code/Magento/AsynchronousOperations/Model/BulkManagement.php#L100 https://github.com/magento/magento2/blob/420a8b6209a4e62ede9...
- mrkeen 6y ago> But it's not a hint to the compiler. It's stating a fact to the compiler. It'll stop compilation. So, if I type out that something's a Banana, and the compiler stops and tells me it's actually an Apple, why did I need to type anything? > Did the other languages (C++, C#, Java) get it wrong? I can only speak for Java, but here goes. Here's something that compiles without warning and crashes at runtime: Fruit[] basket = new Apple[] { new Apple(), new Apple() }; basket[0] = new Apple(); basket[1] = new Banana(); // Crash here You and I know Dung doesn't belong in a basket, but Java sure doesn't. It will not warn about me comparing Fruit to Dung, nor is there a way to ask the compiler to warn me that I forgot to handle Banana: void handleFruit(Fruit fruit) { if (fruit instanceof Apple) { System.out.println("Apple"); } else if (fruit instanceof Dung) { System.out.println("Dung"); } } Here's another one: void foo() { Fruit[] basket = new Apple[] { new Apple(), new Apple() }; handleFruit(basket[0]); handleFruit(new Apple(); } void handleFruit(Fruit fruit) { System.out.println("Do I get called?"; } void handleFruit(Apple apple) { System.out.println("Or do I?"; } In the first code sample we established that the basket could only contain Apples, but now when you handle something from the basket, it's apparently any Fruit. And when you handleFruit an Apple, there's no warning that the compiler is making a choice between the two acceptable handleFruit functions. Anyway, just like me, this Bucket<Dung> is full of shit. Time to dump it all out. I could put it in the compost, or in the veggie garden. Anywhere that contains Dung. Likewise, the Fruit could go in a Bowl, or a Cupboard. Here's a first pass at it: interface Transfer<F, T> { void dump(F from, T to); } class FertiliseGarden implements Transfer<Bucket, Garden> { public void dump(Bucket from, Garden to) { } } class PutAwayFruit implements Transfer<Basket, Cupboard> { public void dump(Basket from, Cupboard to) { } } It compiles, but it's missing the only safety check I really cared about - the contents must match (even if the containers vary!) Let's introduce another type variable X to assert this: interface Transfer<F, T, X> { void dump(F<X> from, T<X> to); } Now it asserts what I want it to assert, but it doesn't compile. I can't call how Java handles the above stuff as 'wrong', since that's stating it too objectively. I can only say I disagree with the above design decisions (if they were deliberate) or I find fault with them (if they just turned out that way).
- enesunal 7y ago"PHP is losing because of its maturity"
- thrownaway954 7y agopeople make fun of php all the time... just see the comments in this thread. people forget though that wordpress, drupal, joomla and magento are all written in php and most likely accounts for 70% or so of all the websites online today. php is going to be around despite all the negativity and fanboyism of other languages. you can't go wrong with knowing php if you always want something to fall back on if you need a job. while coding wordpress websites isn't the greatest job in the world, it is a job and be thankful for that especially during these times.
- ainiriand 7y agoI am a PHP dev with 12 years of experience. I think I have been unemployed 1 week total.
- thrownaway954 7y agogood to hear that. have an upvote :)
- leeshire 7y agoso is PHP worth learning right now? and what is the job prospect looking like? if I study the language for the next few months what is the lickely scenario I will find a career in it.. I actually enjoy and like PHP unlike other people idk what it is about the languauge it looks fun and enjoyable to play with . Plus it's simple and easy opens doors to more complex languages later on down the road
- creshal 7y ago> what is the job prospect looking like? I hope you like working on legacy projects full of spaghetti code.
- jjeaff 7y agoIf I was looking for a job as a developer, I probably would not go with PHP. But if I had a new saas that I wanted to build and turn I to a business, I would seriously consider using php to get to a rapid mvp.
- PaulRobinson 7y agoThere will be work for PHP developers for many years to come. It will not be the sexiest work, but you'll get paid to write code, and any day being paid to write code is better than any day not being paid, or a day being paid to do something you don't enjoy. I stopped coding it professionally almost 20 years ago (!), but it was a great foundation to a ton of stuff, and going back through the release notes and modern frameworks I'm actually thinking I might use it for a few side projects. Don't let anybody put you off, I say if it appeals to you that you should go and learn it and get some work with it.
- s1k3s 7y agoThe amount of misinformation, false claims and unsupported statements in this thread is mindblowing for the quality that I've been used to see on HN. Here are some facts: - Symfony was the backend framework with the most contributors in 2019 [1] (yes, out of any backend framework written in any language) - PHP has more active contributors than it ever had [2] - Laravel is one of the most used frameworks in the world [3] Then I see statements like "PHP only exists today because of legacies being maintained". Can't provide stats on this, but neither can the people who make these statements. Might be just because I'm a PHP dev myself but I see a lot of new projects started with the above frameworks. And last, people compare it to languages like Rust or Go since they consider those are "innovative". I hope everyone understands that a language is fit for a certain type of task. PHP was created for website development, and in that area neither Go or Rust are even close to matching it in terms of maturity. I may be biased but for me, choosing php for a new project is a no-brianer. The only other 2 stacks to which I can compare it are the Spring stack of Java or .NET core, and except for these two I wouldn't seriously consider any other competitor for starting a new project. Unless, of course, that project is "for fun" and you want to experiment with new technologies. [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... [2] https://github.com/php/php-src/pulse https://github.com/php/php-src/pulse [3] https://trends.builtwith.com/framework/Laravel https://trends.builtwith.com/framework/Laravel
- ctas 7y agoMy startups running on PHP and I definitely don't regret it. The language is simple, you have easy access to talent, knowledge, and thousands of mature libraries. Most of the times boring is better.
- jeisc 7y agoplease check out these fast php products swoole, amp, workerman n peachpie at https://www.techempower.com/benchmarks/ https://www.techempower.com/benchmarks/
- fredsted 7y agoI wonder if most developers that trash on PHP for trivial issues like seen in this thread haven't been using it for many years, or had a bad experience (e.g. maintaining a legacy app). Some developers live in a kind of technical vacuum where, I guess they assume, the technical features of their programming language are what makes the difference in the value of the business they're building. In reality, the difference is in how easy it is to hire developers, the package library, overall ecosystem and developer experience, or: how can I make a great product.
- asdkjh345fd 7y agoSome people simply have reasonable standards. I tried for years to hire a PHP dev. I never found a single one. I found tons of people who had PHP on their resume, and not a single one of them was anything close to competent. PHP only makes hiring easy if you don't care about the quality of work that gets done. I can hire a million PHP monkeys, but everyone who has the right combination of intelligence and conscientiousness to be a competent software developer moves on from PHP after 2 or 3 years as they discover what it is.
- ludamad 7y agoYou can hire "good programmers" and ask them to write PHP - Facebook does
- throwaway4715 7y agoFacebook, Slack, Etsy, the list goes on. In fact, I think all thosr companies are actually hiring right now, unlike many of those advanced non-PHP shops.
- pdpi 7y agoFacebook writes Hack, which is nontrivially different from PHP, and those differences matter.
- scurvy 7y ago
- 2ion 7y agoIs it possible to write long-running processes well in PHP today? Is the memory management of PHP up to the task? Or is it all a *cgi-based execution model? This question still is what makes it hard to place PHP. Basically all "high perf"/"high load" applications of it I know about run under PHP-FPM or webserver modules or uwsgi.
- AegirLeet 7y agoLong-running processes are definitely possible. You obviously have to be a bit more careful not to leak memory. It's common to have things like queue workers implemented as long-running CLI processes. I just checked one of our services at work and there's a queue process that has been running for more than 4 months. There might be others that have been running even longer, but I don't feel like checking every service right now ;) Projects like Swoole or ReactPHP are trying to make similar things possible for serving web requests too.
- maitredusoi 7y agoWho on earth is using PHP in 2020 ;)
- no_gravity 7y agoPHP has a lot going for it. It is popular, fast, has a nice syntax and a ton of useful functionality baked right into the language. The main weakness I see in PHP is the lack of modules. PHP provides namespaces to avoid name conflicts. First of all, that does not completely root out naming conflicts. The developer who puts a namescpace into their code can only hope that it does not clash with someone else's. Secondly, it makes it necessary that both, the code that provides reusable functionality and the code that uses it have to deal with the issue of namespaces. A module system like Python and Javascript have is superior to this. Then only the user of the reusable code decides where to put it into the namespace.
- AegirLeet 7y agoI'm a PHP dev and I'm pretty happy with the language, especially some of the things introduced in recent versions. I think it's a fine choice for anything that doesn't fall in the "low-level, high-performance" or "mobile/desktop app" categories. For web applications, I think PHP's idea of a clean slate for every request also makes a lot of sense and immensely simplifies development. I can write a simple PHP application that handles thousands of concurrent requests without even thinking about threading, synchronization, memory leaks or anything like that because handling that stuff is basically built-in. PHP has a really good ecosystem. A framework like Laravel can do just about anything you'd need in an application out of the box. Routing, rendering HTML, generating URLs, handling sessions, logging, validating requests, an ORM, translations, encryption, sending emails, queues, schedules, caching - it's all there. I've never seen anything quite as fully-featured in any other language. On Packagist, I can find packages for pretty much anything from clients for obscure SOAP APIs to libraries for handling GraphQL. There's also a lot of great tooling, with a good package manager, static analysis tools like Psalm, code formatters etc. Also, PhpStorm is a fantastic IDE. Outside of PHP, I mostly have experience with Java and JS. If you know Java, modern PHP isn't all that different. Java has some nice stuff that I hope we'll get in PHP some day (generics is the big one). I built an application using the Play framework (Java version) a couple years ago and it was quite similar to modern PHP frameworks. However, there was always a bit more complexity with Java. Everything was just slightly more complicated. So with the trade-off basically being performance (which is better in Java) vs. ease of use and developer experience (which I think is better in PHP), I'd choose PHP most of the time. Now, when comparing it to JS, I'm really glad I mostly get work with PHP instead of JS. I know this might sound strange coming from a PHP developer, but holy shit, JS is a mess. When writing JS, I'm constantly going between "oh, nice, this is really easy to do with Vue" and "what the fuck does that error even mean, how am I supposed to find any problem buried under several layers of bundlers, polyfills, loaders, transpilers and reactive frontend black magic?". If JS wasn't the only thing that works in a browser, I would avoid it like the plague.
- cletus 7y agoIt saddens me to see some of the (largely baseless and otherwise largely historical) hate for PHP. I use Hack in my day job, which has at this point diverged from PHP, and I like it for the most part. The thing that PHP does right that so few languages do is having a stateless core in the webserver. This is an incredibly efficient approach to serving HTTP traffic. Consider the startup cost issues with Java, or Rails' single request at a time model or even Python's startup (and GIL). The second thing PHP does right is it request scopes everything. Simply throw away everything you created when the request ends. No dangling references and memory leaks (pretty much) like you get with stateful Java services (eg whatever servlets is now). And the third is no multithreading in the core API. Starting and synchronizing threads is incredibly difficult to get right and adds a huge overhead to everything with little gain when you're just servicing an HTTP request, almost all of the time. Hack has 2 things PHP7 doesn't quite have that I'd miss: 1. A better type system; and 2. async/await for cooperative multi-tasking. I still hate the backslash for namespaces though.
- spdionis 7y ago> The thing that PHP does right that so few languages do is having a stateless core in the webserver. I never understood why the HN crowd always ignored this massive benefit of PHP, in a world where it's becoming clearer everyday that keeping things stateless across the stack provides many benefits towards managing complex systems.
- q3k 7y agoBecause this is not always a benefit. Want to cache something in between requests? You have to use memcached/redis. Want to have some background or periodic processing? Set up cronjobs, and/or use an external job queue system. Sure, if you're writing a simple CRUD app with and RDBMS backend it can be just fine. But when you're dealing with more complex work just being able to start a goroutine or use an in-memory cache structure is so much nicer than having to deal with external systems.
- kstrauser 7y agoMost of the interesting things I’ve worked on would fall down if you couldn’t cache some stuff across requests, like database connections. If every request requires a new TCP connection, even if to something lightweight and fast like a local pgbouncer instance, requests are going to be a lot slower (and the time spent context switching from userspace to kernelspace and back a lot higher) than if you could reuse one from an in-memory pool. I love stateless stuff and have started moving a lot of things to Lambdas where appropriate, but I wouldn’t use a completely stateless setup for handling large numbers of requests per unit time.
- fergie 7y agoPHP -> much better that people often give it credit for I've hardly ever used PHP over the course of my 20 year career, being mostly on C, Java and JavaScript, but on the few times that I have, I have always been really impressed with all aspects of the experience. Whatever academic semantic deficiencies PHP might have, there is no more accessible language for making web site backends with and its sad that so many people are discouraged from using it.
- fimdomeio 7y agoIt's sad that php as such a bad rep that I figured I should say "I code in Go. Php? Yeah I can do that too" so I don't get some eye rolling and an instant prejudice I'm a cheap coder. For it's age php is great and pretty easy to setup (having to intall separate modules for imagemagick and cryptography is just a tiny assle). Composer should really solve it's large memory usage problems, but other than that it's pretty good. It's really good for it's intended purposes and is getting a lot better in latest versions.
- thrusong 7y agoI've been programming in PHP since 2007 and I absolutely love it. I've long ignored the hate for it here. I worked hard and followed best practices to get good at PHP. In 2015, I started writing "projectionist" software in PHP to completely automate my home theatre. I was a projectionist at three different theatres for about half a decade. I spoke with old-timers to really get it right and have been tweaking this script regularly ever since. I've got a Netflix-style website for my movie collection. I can watch a feature either in my browser or choose to play it in the cinema. I can even schedule a feature for 7:00pm and it will wake-up 30 minutes before with music and nice lighting, assemble all the dancing hot dog ads and trailers, play it, turn the lights on for the credits, and shut itself down 30 minutes after. The little ODROID running the whole theatre opens a chat room connection over XMPP with my servers so it can respond to controls in the app, whether I'm adjusting lighting or sound levels, putting it in Desktop mode, or manually controlling the curtain and projector. I just ignore the PHP hate because I find it extremely powerful- it can do everything I could ever need. I also always want to keep an open mind. https://www.youtube.com/watch?v=Cc8K6lg7Ag8 https://www.youtube.com/watch?v=Cc8K6lg7Ag8
- infamia 7y agoThis is fantastic! Do you have a code repo somewhere?
- thrusong 6y agoUnfortunately, no, I haven't published the source code. I'd maybe like to commercialize it in the future, but it would require either some tech to compile PHP or would need to be re-written. I think it's a really simple system overall... It uses XMPPHP (updated for PHP 7) and otherwise it's just a lot of loops, network calls, and proc_* functions.
- perlgeek 7y agoCan anybody comment on the state of Unicode in PHP? I dimly remember that "proper" Unicode support was planned for PHP 6, and being one of the features that delayed that version, and contributed to it being skipped altogether.
- vatotemking 7y agoThis may sound hurtful but hear me out - One thing worth mentioning why someone would not want to use PHP in 2020 is that a PHP programmer is looked down upon by other programmers. And im saying this without hate or malice. I love PHP since I was a PHP dev from 5.2 - 7.0. I built PHP libraries and WordPress plugins that have helped many people. Ive since moved to Node because PHP jobs have dried up in my country. PHP devs arent respected which is sad because we all belong to the same programming community. And PHP has contributed a lot to the proliferation of websites. At the end of the day programming languages dont matter to businesses as long as it gets the job done at a reasonabe cost.
- gnarbarian 7y agoHaters gonna hate. Node.js programmers are looked down upon too by go programmers. C programmers are an anachronism, haskell is for academic navel gazing etc. Small minds think their favorite language is the best because they can't see outside their own problem domain. Languages are tools that suit different needs. Use the best tool for the job, pay attention to industry trends so you don't become a Cobol dinosaur with no job prospects. Switching to node is a good career move but it won't be your last. Node has incredible momentum and developer mindshare. You can accomplish a lot with it but node projects are difficult to maintain. Never stop learning or growing.
- wolco 7y agoIn fairness the wheel has turned and node developers are seen as not respected. If you haven't moved to go/rust/serverless by 2018 the cool market has moved. When I got started in 2000, php developers weren't as smart as perl developers. Then it was asp. No serious business would use php over asp. Java developers always had this attutiude but they were always treated as second class from c++ developers who were treated bad by c developers who were using a toy language compared to asm. At some point 2006/2007 php became cool. But then the facebook movie came out and php was uncool again. Ruby on rails was better (unless you were twitter and wanted to scale). Then node. Go. Serverless. PHP has always been anticool and looked down on. You need a strong sense of self to get involved.
- 7y ago
- qu4ku 7y agoIf you want to know why-the-hate watch this[1] talk — one of the best and eye-opening talks I've ever heard. It has nothing to do with the language itself and everything to do with the user of the language. [1] The Pervert's Guide to Computer Programming Languages https://www.youtube.com/watch?v=mZyvIHYn2zk https://www.youtube.com/watch?v=mZyvIHYn2zk
- ashtonkem 7y agoI ended up using PHP while I worked in a design shop, as it was extremely easy to both implement designs in and easy for low-tech clients to run. It wasn’t bad. Good docs, reasonably easy to run & deploy (except Wordpress). I don’t think I’ll ever use it again more due to career reasons, temperamentally I prefer the backend, but given the same circumstances I’d use it again.
- somurzakov 7y agocan anybody explain what is the purpose of static typing in a dynamic language ? It's not like you get benefit of compilation like java/C#. Why is PHP trying to become java so hard, if there is already java and .NET ?
- proto-n 7y agoYou can compare static typing in php to typescript or static typing in python. It's for correctness, not performance.
- aceman22 7y agoLaravel is the best REST api framework in existence for any language. Change my mind.
- nuncanada 7y agoREST is a waste of time and effort, use GraphQL.
- tzs 7y agoHow well are older releases of Laravel supported? I see on their website they are on version 7.x, and have documentation online there also for 6.x, 5.8, 5.7, 5.6, 5.5, 5.4, 5.3, 5.2, 5.1, 5.0, and 4.2. For those with a conservative server software approach who install a Linux distro that will have long term support and then stick with it up until near the end of that long term, and stick with the version of PHP that came with the distro, we have to go back to 5.5 or 5.4 or maybe even earlier to get a Laravel that works with our PHP. (Symfony appears to be at 5.3, with 4.4 and 3.4 still maintained. 3.4 will work with most major distros that are still in LTS, except I'm not sure about RHEL. 4.4 has the same requirements as Laravel 5.6, and so misses out on some existing LTS distros).
- mtnGoat 7y agoi would probably look at updating and keeping a more secure OS that can run modern software. Asking a framework to maintain a version of their framework for a version of PHP that is no longer supported, is not realistic. also laravel is open source, if you want to update an old version because you want to run unsupported software, you are welcome to do it yourself also.
- gabordemooij 7y agoFunny, while I see that many people enjoy the features that come with this maturity (and I am happy for those people of course), I long for the simplicity of the classic style PHP. Personally, I do not enjoy the Java-style 'enterprisey' direction of PHP. I don't like types, anonymous functions, treats and all the other fancy stuff. To be honest, I think I myself would still be happy with PHP4. I use thin scripts, almost no classes, alternative PHP template syntax and I am completely frameworkless. But I guess I am just a nihilist ;-).
- luckylion 7y agoI do like the enterprisey direction personally, mostly because it works so well with a good IDE. I'm using PHPStorm and once you've got your project set up, code completion/suggestion and inspections are something I love.
- DonHopkins 7y agoNow the trash dumpster is no longer actually on fire, and it has nice bright orange flames painted on it, like a racing car!
- chipotle_coyote 7y agoI'm starting a new project in PHP now. I've used the language for a long time, I think starting with the 3.x days, and it's come a long way. There's a lot of good things about it. But. I recently joked in frustration that I missed the days when PHP was a cargo cult version of Perl rather than a cargo cult version of Java. It's a joke, it's not a fully fair criticism, but I can't help but feel there's some truth to it. PHP is a fast dynamic language literally designed for embedding in web pages, with a batteries included mindset that shoves all sorts of useful things into the language itself (yes, kind of haphazardly and occasionally in slipshod fashion). If I want to know what the path of the request is, for instance, I could just do: $url = parse_url($_SERVER['REQUEST_URI']); $path = urldecode($url['path']); But that's not The Right Way anymore, is it? Instead, I should use a PSR-7 compliant request object, and do this: $request = Laminas\Diactoros\ServerRequestFactory::fromGlobals(); $uri = $request->getUri(); $path = $uri->getPath(); "Okay, Chipotle, but that's just one more line, stop whining." Sure, but it's three lines that instantiates a Request object that in turn instantiates Stream and Uri objects and importa two Traits and implements, I don't know, let's say four? four Interfaces, and-- "Come on, it's still fast." Yes! Sure But you know what's faster? Looking at the $_SERVER variable. I can't help but paraphrase a famous quote: Some people, when confronted with a problem, think "I know, I'll use a design pattern." Now they have two problems. I know. I know. Using factories and dependency injection containers and tying yourself into knots to avoid anything that remotely looks like a global makes things testable and composable and decoupled, but it is so freaking heavyweight compared to other dynamic languages. Python's Flask web framework has a global context object just called "g", which is essentially a singleton that lets you arbitrarily store properties on it, not just variables but database connections. OMG GLOBAL RUN AWAY AAAA no, you know what? It's fine. Yes, in some sense it's probably more dangerous because someone could come along and blow away your database connection by overwriting the "g.db" property, but maybe sometimes the simpler answer is "well, don't do that." Look, I've used Symfony, and CakePHP, and Laravel 4. I think I even contributed a test to Laravel 4's testing framework way back when. They're great. And I'm not saying "let's all just throw out objects and all separations of concern and mix HTML and business logic like it's 1999, baby." But PHP is virtually a framework on its own, and at times it feels like many smart people have put a great deal of effort into building entirely different frameworks on top of it, paradigms that PHP wasn't intended to fit into. So for my new project, I'm just... rolling it all from scratch. I don't have a composer.json file because I don't need PHP-FIG compatibility--although the four-line autoloader I have would technically load any PSR-4 compatible module if I wanted to. It's using the front controller pattern, it has regex-based routing, it has a simple template system with layouts, it has request and response objects, it uses type hinting. It's probably not super great, but it's... kind of refreshing to write this way. I love PHP despite its warts, and it's great that it's learned so much from Enterprise JavaBeanServerNetSwingPattern land. But I admit I'm kinda hoping for it all to get a little more relaxed about, you know, still being a dynamic language.
- block_dagger 7y agoAs someone who started my career in PHP in 2002 and switched to Rails in 2008, I can say I do not miss PHP. I still maintain my old apps only because of the high pay associated, not because it is joyful. PHP's version of "mature" does not match other modern langs, not even close imho.
- anonyfox 7y agoMany emotional language bashing comments here, and everything between „php is dead“ to „php is awesome now“. Personally I liked that php has an ultra low entrance bar: shared hosting for $2, ftp deployment, no advanced syntax to understand. When starting work in teams instead of solo and coding nontrivial business rules, this ease of doing died for me. Moved on. Many years of JavaScript, doing nodejs since 0.4, it was just like having superpowers and doing isomorphic things. Mixing things every other month with coffeescript, babel, typescript and trying a different framework for every new project. What once felt refreshing is now just exhausting and JS projects tends to end in rewrite loops. Before/Inbetween/After there were many languages, from C at university, to C#, Ruby, Go, ... . Mostly the tech didn‘t change much, but over time emotions change for me. Longest streak of love had ruby, shortest had Go (just a few weeks before it became disgusting for me). I believe thats Personal and different for everyone. After all my reflections I finally settled with just two choices of techstacks: Elixir/Phoenix for all things Web and Rust for everything else. Writing highlevel businesscode , interactive exploration of things, CRUD things and realtime frontends in Phoenix is a breeze. But this ease of use has tradeoffs as always, I always feel that this dynamic code is somewhat „fluffy“, but ist seems that this is a key to prototype and ship things rapidly. When i do want to do things that feel more „substantial“/„meaningful“ than just assembling yet another web product, I Switch to Rust. Producing a statically linked, crosscompiled binary that is „proven“ to work after discussing with the compiler is deeply satisfying for me. Unlike those „fluff“ / yet-another-web-product work. Full Circle to PHP: awesome to see static typing available now! But this alone doesn’t make it feel so heavily baremetal for me, still fluffy with types bolted on. It is the fastest php ever, but still in the ballpark of scripting languages. It has mature, productive frameworks, but Phoenix feels superior and leading the way (next rails? Dunno), so why bother if php plays catch up to moving targets? Software Development has become somewhat like fashion now, and PHP looks like those jeans jackets people had in east germany. Not inherently bad, fully functional for its purpose, but once you experience the taste of freedom in the western world you insist to have „real“ things. Best metaphor I can think of, but as stated: most discussions here are highly emotional, and it’s hard to put that in words.
- dilandau 7y agoPHP is great. Nothing comes near as close when you just want to shit some SQL-queries onto a page, or add some basic interactivity. Just drop your scripts in /var/www and let apache do the rest. It's like magic.
- KerryJones 7y agoAs someone who has programmed PHP professionally for 13+ years (and also JS and Python) I have never run into anyone who can place a solid argument since the PHP 7 + Laravel. -- Let me clarify, PHP is useful with context. For building web apps. Each language has its best-uses. Laravel has the strongest ecosystem and community out of any language/framework combo I've seen. I can literally setup and deploy a laravel application on a horizontally scaled setup with CI & autodeploy within an hour -- while maintaining industry standards. PHP had its problems -- historically, but so did most languages. Do you remember Javascript before Node/React? Or before jQuery/Prototype? It was _trash_. The biggest "con" to using PHP is that it's "bad" for the resume, no one is excited about it, so when looking to hire for it, most developers don't feel inspired by it -- which is a serious consideration depending on your circumstance.
- srhngpr 7y ago> Do you remember Javascript before Node/React? Or before jQuery/Prototype? It was _trash_. Anyone remember Dynamic Drive DHTML? http://dynamicdrive.com/ http://dynamicdrive.com/
- paulgrimes1 6y agoHa! I recall Dynamic Drive.
- dpacmittal 7y agoJavascript is still trash. What with the insane amount of configuration and build tools, extremely small standard library forcing you to use third party modules which may or may not have tens of security issues and the dependency hell it brings with it. I can go on and on.
- CSSer 7y agoI was raised in the darkness, so things don’t often look as bad as they are to me. Regardless, the clear distinction between PHP and JavaScript seems to be that I can choose whether or not I’d like to use one but not the other (and no, wasm doesn’t count because it still requires JS). For me, I just don’t why I’d choose to use it for a green field project. Sure, it’s better now, but people have warned me to stay away from the boogeyman lurking within. Maybe it’s there, maybe it’s not. But why should I take the risk if it’s pretty much the same as other modern languages that might have cool stuff.
- root_axis 7y agoAh, it's like old times again. Nowadays all the language-snob threads are directed towards JavaScript, but I remember the days when PHP was the language of choice for what HN considers the inferior programmer. Fun memories, all this thread is missing is a link to the fractal of bad design rant.
- localareaman 7y agoIt's not language quality and merits per se that are important. It's much about establishing status within a tribe that counts. PHP is seen as a low status language because many junior or moderately skilled programmers use it. Rust is a popular language among up and coming young programmers because they expect to over throw the dominance of older C++ programmers. Haskell is for the high priests if that is your path to power and status.
- root_axis 7y agoI agree with your analysis.
- JadeNB 7y agoWhy was the title changed from "PHP showing its maturity in release 7.4", which doesn't seem clickbait-y or anything?
- ChrisMarshallNY 7y agoPHP is the Web's C++. It keeps getting declared dead, but then, keeps rising from the grave. I wrote PHP for a long time (more than 20 years). Many, many thousands of lines of it. I got fairly good at it. I wrote my last big application in it about a year and a half ago (PHP 7.3, I think). It's a great application, but no one would want it, as it does the same thing lots of big SaaS does. Except one single person wrote it, from soup to nuts (no dependencies), in about six months -part time- (it was sort of a "thesis" project for me, as I was re-learning my engineering discipline), and it's quite good quality. So I guess PHP is good for something. I just open-sourced the application, and more or less sent it out to stud. https://riftvalleysoftware.com/work/open-source-projects/#baobab https://riftvalleysoftware.com/work/open-source-projects/#ba... I discuss my design methodology for the project here: https://medium.com/chrismarshallny/forensic-design-documentation-54541925d30e https://medium.com/chrismarshallny/forensic-design-documenta... That said, I never really liked the language, and am glad to have seen the back of it. I write full-time in Swift, nowadays, and would be thrilled to never write PHP ever again. Despite all the hate, though, it's a perfectly good language; especially with all the stuff added in 7+.
- georgianar 6y agoThanks to Robinson buckler ..Email this great herbal doctor cured me from herpes virus and he brought my ex lover back via his email robinsonbucler@gmail. com ...........
- tabtab 6y agoI really miss optional named parameters. I hope PHP adds that feature.
- cutler 6y agoWhat put me off PHP for life was the assumption by employers and recruiters that PHP rates are at least 20% lower than for JS, Rails or Django. PHP just isn't respected professionally.