15 ms·
Perhaps. But that rather begs the question. PHP has horrible bits, but in fact from what I've observed in the last year or so is that whilst it has in the past
by chris_wot 10y ago
Perhaps. But that rather begs the question. PHP has horrible bits, but in fact from what I've observed in the last year or so is that whilst it has in the past been fairly horrible, much of what made it awful can be entirely avoided.
If you aren't following the PHP Framework Interop Group (http://www.php-fig.org http://www.php-fig.org) then you really should. I'd hazard that most of the warts in PHP can now be avoided pretty much altogether, and those that can't quite possibly can be worked around through configuration.
- brian-armstrong 10y agoAn easier way to avoid those warts would be to pick a different language
- ux-app 10y agoand miss out on all the awesome aspects of the language/environment?
- peteretep 10y agoWhat are "all the awesome aspects"? The being embedded in the web server and the benefits that brings I understand. The rest?
- justinhj 10y agoDisclaimer I worked on a large php app server that ran on about 50 servers and I miss it. The documentation is really good. A model for programming language documentation. Process per request is really simple to understand and scale. Your servers almost never crash completely, you don't get threads silently dying or run out of memory or thrash the CPU doing garbage collection. It runs like a tank. It will, for better or worse, just keep running when more fussy languages would have seg faulted or shut down The tooling, framework and libraries are very advanced and in active development It's easy to train a programmer in php It's close to the c library The combination of a very flexible array/map and functional programming tools like map and reduce let you write pretty declarative code and development can be very fast Php storm Facebooks replacement runtime I work with Java and Scala now which I also love but development is much slower and more expensive, whilst deployment is cheaper (less hardware for same request throughout)
- premium-concern 10y agoI stopped taking this seriously after "the documentation is really good". Not sure whether this is your real opinion or you are just making fun of people who say that.
- justinhj 10y agoWe can't argue objectively about an opinion but take a look at this typical page of the php.net documentation: http://php.net/manual/en/function.usort.php http://php.net/manual/en/function.usort.php It has everything I need to know about the function clearly laid out. The behaviour of sort when elements are the same. A list at the side of related functions that I may want to look at instead. I also like documentation that includes user contributions as these often add useful caveats and usage examples that don't fit well in the general documentation.
- babyrainbow 10y agoPhp documentation is the worst. Some of the reasons.. 1. They have exactly one set of documentation pages for all the php versions. 2. Another thing is that documentation can be quite wrong for even the fundamental stuff. I have seen a core developer blast out in reddit that "The documentation is wrong!", when the other party pointed them towards a piece of documentation. 3. Incomplete or shallow description. Go check out the documentation page for Exceptions in php and try to find information regarding the behavior of return statements in a 'finally' block. Now go an see the respective page in Python documentation and see how in depth the documentation is. And having code samples is not exclusive to Php's documentation..
- apotheon 10y agoCan you describe for me how the tooling, framework(s), and libraries are so advanced and excellent? How easy is it to train a programmer to use PHP in a way that results in fairly secure, reliable, bug-free code? (Note my use of the word "fairly", knowing that there's no such thing as perfect security, reliability, or freedom from bugs.) I do know that, for instance, TDD is possible with PHP. In my experience and observation, though, the available developer tooling does not even come close to that of (for instance) Ruby, so I figure I must be missing something if "the tooling, framwork[s,] and libraries" constitute a major advantage to PHP over other options.
- NMDaniel 10y agoThere are plenty of great server-side languages and environments. C#,Java,Scala,Python,Ruby,Haskell. If this was about JavaScript and Front-End I might've agreed with you (there are transpilers but interoperability with JS modules can be tricky), however in the realm of servers there's so much freedom.. so why choose PHP out of them all?
- mastazi 10y ago> plenty of great server-side languages and environments Depending on the type of project, I would choose PHP over at least some of the languages you mentioned; I guess "great" is not a significant quality when making architectural choices. Just to be clear: I was thinking about factors like performance, choice of servers, how easy it is to hire good developers, library ecosystem etc. EDIT: obviously the "awesome aspects" mentioned by GP are a similarly unsubstantiated claim ;-)
- brianmurphy 10y agoIf you are building software that will be deployed by a large number of users, having PHP provided by every $3.99 & up hosting company can't be underestimated. Languages like Haskell are nonstarters.
- raarts 10y agoC#: windows or mono-on-linux Java: keyboard wear Scala: not enough programmers Python: not bad Ruby: too slow Haskell: math grad required
- NHern031 10y agoThe .NET CORE is now open source and cross platform. Cross platform compatibility with the exact same source code, and the killer features/speed of C# makes its my personal choice for a server-side language. I would like to add that C# devs are not cheap and also seem to be slightly more limited in today's market compared to PHP devs.
- sjellis 10y ago
- anexprogrammer 10y agoPHP devs aren't expensive. Even good ones. It's easier to reroll in another language and retrain or recruit? No. So you probably mean for a new project. So now you've more maintenance and learning curve unless you just happen to have enough skilled in $NEWTHING. Not really easier. PHP is an inconsistent mess, everyone knows that, but it's cheap, widely understood, and it's perfectly possible to write decent maintainable code. There's ways to mitigate the chaos.
- collyw 10y agoTrue, I have seen one startup fail early because he couldn't find any (cheap) Django devs. He might have stayed around another year with the funding he had if he had gone PHP.
- foolinaround 10y ago> PHP devs aren't expensive. Even good ones. Would'nt the good ones logically move to a different language ( JS/Ruby etc ) where they could bill more?
- sethrin 10y agoMoney past a certain point is not an incentive. Retraining takes time. It's harder to land jobs for which one does not have relevant work experience. The PHP job market is larger than most other web programming segments, so work is easier to find. But sure, if you're hiring, I'd certainly prefer working with Ruby.
- wyager 10y agoIt's not just about the obvious "warts"; it's about the fact that PHP is not a well-designed language on the first place. A wart-free pig is still a pig.
- igravious 10y agoThat's a bit harsh on pigs.
- chiefalchemist 10y agoBest comment so far.
- Aldo_MX 10y agoWhich of the top languages is actually well designed? All of them have their area of opportunity.
- wyager 10y agoRust and Haskell are both extremely well designed. Most of the "top languages" by percentage usage are 20+ years old, so I can't fault them that much for being badly designed, but we should definitely stop using them.
- codedokode 10y agoRust looks very complicated to me because there are "lifetimes" and you need to think where to put those single quotes properly. Not a language for a beginner. Haskell doesn't support OOP if I remember correctly. And it is complicated too.
- steveklabnik 10y agoDue to lifetime elision, you rarely need to explicitly write lifetimes. I participated in the last Ludum Dare game competition, my game never used an explicit lifetime. That said, it is true that Rust has tricky parts. The domain is inherently complex.