9 ms·
In many ways PHP is just now starting to come into its own
- PLejeck 13y agoWhile it's certainly true that PHP is better than it was 7 years ago, that is primarily in the ecosystem and not the language. The language remains as bad as it was 7 years ago, and they seem to be woefully unwilling to actually fix it.
- harshreality 13y agoA fixed php would be a different language. The differences between Python 2.x and 3.0 would be minor compared to what would need to be fixed in php... and look how well that migration has worked out for python.
- pekk 13y agoIt has worked just fine for Python, now. Maybe your impressions of how well it went were set in 2010 and not revisited?
- PommeDeTerre 13y agoWhat you say is very true. PHP is in the same boat that JavaScript is in. Their very severe, yet very inherent, language flaws just cannot be covered up with one library or framework after another. The only real option is to give up backward compatibility, to then throw out every broken language feature, and to then reimplement them properly. Unfortunately for those two languages, that would involve an awful lot of stuff getting thrown out and reimplemented, which is very likely why it hasn't happened yet. Given how much core functionality needs to be reworked in both cases, I don't think they can really be saved. There are numerous other better languages out there, and it's easier just to use them instead of trying to salvage PHP or JavaScript.
- philipp-de 13y agoThey are doing it, though. For example they have now deprecated the dreaded mysql_, pgsql_ interfaces (including mysql_now_escape_the_string_for_real() and the like ;) for accessing the database in favor of PDO. They will be removed in the future. Lots of projects still use those. Just 1 example of PHP dropping backwards compatibility. It's not quite so bad as you make it out to be.
- PommeDeTerre 13y agoDeprecation of those awful vendor specific DB extensions is a good start, no doubt. But those are library functions, rather than language features. Another thing to consider is that PHP developers have a track record of deprecating certain functionality, then a few releases later changing their minds and no longer deprecating it. Some examples of this include is_a, and var in property declarations. Given how it's still relatively common to see PHP 4.x installations in use today, 10 or more years after they were first released in some cases, merely deprecating some of the broken functionality now won't help much. We'll still see deprecated features in use in 2020, if not well beyond then. The broken functionality needs to be stripped out completely within a reasonable time frame (well under a year), not merely deprecated and left around for years, if it even stays deprecated. But this involves the PHP community acting responsibly, and going along with these changes for their own good. I don't think we can expect that level of responsibility out of them, unfortunately.
- giulianob 13y agoLook at how slow Python 3 adoption has been. I don't think completely breaking backwards compatibility is a quick thing. The Python folks expected 5 years for Python 3 to become the default version because of the dramatic changes. http://programmers.stackexchange.com/questions/63859/why-do-people-hesitate-to-use-python-3 http://programmers.stackexchange.com/questions/63859/why-do-...
- PommeDeTerre 13y agoNot every Python user uses Django, you know. I've worked on a number of software systems at several different organizations that have very effectively used Python 3 for years now. I think that Python 3 has been adopted perfectly fine by many other people and organizations, too. We're just not overly vocal about using it, because it has worked for us with so little pain and so little effort in many cases. It really wasn't much different going from 2.7 to 3.0 or 3.1 than it was going from 2.6 to 2.7, for example.
- dasil003 13y agoHow would they fix it anyway? It was never really designed, it just evolved as a slow accretion of features using whatever syntax was convenient in the parser codebase over a couple of decades. The author makes a good point that people like me who ditched PHP in the mid-2000s should probably stop complaining about it since we don't really know the current state of affairs. The problem is when we have languages like Ruby, Clojure, Scala, Haskell, or even plain old Javascript ala Node, why would I waste another thought on PHP? PHP was created to make very simple dynamic web pages, and I would still use it for that in the way that I still write bash scripts for simple shell operations to avoid a higher level dependency like Ruby or Perl. I'll use PHP for small stuff, but I see no benefit towards putting any real engineering effort into a PHP project.
- philipp-de 13y agoJavascript, of all things, wasn't neatly "designed" either. The core language was hacked together in several weeks, by a few developer at Netscape. Javascript wasn't made for large applications. It was made for form checking and rollover menues (some of the earliest examples back in the day) ;) It can be argued that Javascript has many unfixable design bugs, too. Just sayin.
- dasil003 13y agoWell that's why I said "even" Javascript. Brendan Eich actually pulled off a small miracle by embedding incredibly powerful functional and prototypal paradigms in JS. It's not perfect, and there are plenty of warts, but JS came out of the gate with a powerful core that PHP took decades to add in a Frankenstein manner.
- PommeDeTerre 13y agoEnough with the "JavaScript is a functional language" myth, please. Merely having first-class functions does not make a language a functional programming language. JavaScript does not promote the use of pure functions, referential transparency, and the minimization of state. JavaScript does not encourage the use of recursion. JavaScript has an atrociously broken type system, rather than a robust and theoretically sound one. JavaScript does not offer pattern matching and other functionality offered by modern functional languages. In fact, JavaScript goes out of its way to promote a very imperative, non-functional style of software development, even when efforts are made to try to use it in a functional way. And JavaScript's prototype-based OO is anything but powerful. In practice, it's nearly useless. That's why we see so many JavaScript developers try to fake a class-like OO system using it, since class-based OO does offer what they need and want. But due to the incapability of JavaScript's prototype-based approach, these hacks end up being incompatible maintenance headaches. JavaScript does not have a "powerful core". It has a rotten core, just like PHP, and it has evolved in a broken manner, just like PHP.
- level09 13y agoI strongly disagree, php 5 has introduced a lot of fixes, performance improvements and many nice and great new features. I'm a big fan of python and I think that very intelligent people are behind its architecture, but honestly most of the money I made through the past years came from php websites that I can build really fast. I have eventually used python (fabric) to automate creating php websites.
- agumonkey 13y agoNot so fast. PHP evolved a lot as a language, maybe it will never be enough to fix its ancestry, but namespaces, closures, generators, ~~typed~~ expressions (you can finally slice a function call returning an array without unnecessary variables) and some literals. It's still not 1958-worthy to me, but they do evolve.
- rizalp 13y agoIt is evolved indeed, but is there any language designer / guru who ever come close to exploring its good parts (like Douglas Crockford did with Javascript)? I don't think so...
- agumonkey 13y agoWell, first I think it's irrelevant with what we were saying. Secondly, I doubt there will ever be such a document toward PHP, since it wasn't conceived with a linguistic background (Rasmus Lerdorf wanted a pragmatic dynamic layer on top of C code without resorting to perl). There's no special abstraction principle in PHP, as opposed to prototyping, which (after a quick wikicheck) is not a core abstraction in mainstream languages and could benefit from a book explaining how to think in it. PHP is more and more aiming toward mainstream class based OOP, and everything has been said about it but I can be wrong.
- mgkimsal 13y ago"Jeff Atwood has stated publicly that one of his ulterior motives with the Discourse project is get people to stop using PHP and start using Ruby." This just won't ever happen. The people that wanted to drop PHP for something else (Ruby, etc) largely did so years ago. The hosting/running situation for PHP is just too basic and easy for people to get in to vs having to 'run a server' (Rails, etc). PHP is still the only language that assumes HTML output by default. Put a file on a web server, hit it via a URL, and get HTML output. It's that simple. You can start at 'simple' then graduate up to complex stuff like Symfony if/when you want to. Every other language or platform forces a lot of extraneous concepts on you on day one, which is always going to be a turn-off for a not-insignificant portion of the people coming in to the field.
- wyclif 13y agoRelevant reference wrt this thread: http://www.phptherightway.com/ http://www.phptherightway.com/
- DangerousPie 13y agoExactly. I am still using PHP for pretty much all of my projects despite all of its shortcomings. The reason for this is just how easy it is to write simple scripts and deploy them. For most small hobby projects it is just not worth spending hours setting up the development environment required to create a Ruby/Flask/... project when you can achieve the same thing with a single PHP file. And when it comes to deploy it, virtually every single managed web hoster out there supports PHP, so you just upload the file and it works. I did play around a bit with Flask a while ago and it does feel a lot cleaner and more efficient. But once you actually try to deploy your app you realize that hardly any web hoster actually supports the required Apache extensions and suddenly you end up having to set up your own server and fiddle with config files to get it to work.
- orf 13y agoAfter you do it once you realize its not that hard to deploy. Nginx -> Gunicorn -> your app
- kayoone 13y agoIve been working with the Symfony PHP Framework since 2007 and to me it has transformed PHP completely. Many people left PHP when Rails came along and never looked at it again, and the biggest misconception is that many of those still look at PHP like it was in 2005/2006. But alot has happened! Symfony2, my framework of choice, has a very mature and solid architecture and offers anything you could imagine from other frameworks. The code is clean and maintainable if done right and still its extremely flexible and extensible. It also depends on PHP 5.3 which has Namespaces, closures, lambdas etc. So id argue its up there with any of the other top Frameworks, it might even be the best. While its true that there are languages that are more beautiful to work in, i dont think its all that bad. For me, the biggest flaws of PHP are present in any dynamic-typing language. The syntax is just stuff to get used to once and be done with it.
- thejosh 13y agosymfony2 is a beautiful framework. I have been using symfony1 since january 1st, 2008 and then migrated across to 2 for other projects. symfony2 is a solid framework for php, and very quick to get started and maintain. With composer it is even easier, and git repositories are pretty small as well.
- cies 13y ago> If PHP hadn't evolved [...] > But it has. Honestly, how can languages (what PHP in the end boils down to) possibly evolve? Example: you cannot bolt OO to it later on, PHP, Perl and to some lesser extend even Python are a testimony to that. It just does not feel right, leads to syntactic horrors and is usually not very performant. Neither can you modify the syntax. You can add to it. But not much modify existing syntax. For tiny changes all hell breaks loose. > [...] and feel like they're doing the wider community a service by making declaring a religious war against PHP. I think the religious-war card is clearly overused. This is not a religious-war, it is an effort by programmers who rather use the best tool for the job then the bizniz/customer dictating them a languages/framework/CMS. PHP will not be fixed, mission impossible, they know it and therefor advocate a retreat-strategy. The article describes that the community has (be it very late) finally developed some tool, a package manager, that make it slightly more bearable. But the language and its community still suffer the exact same unfixable problems. An analogy: even in COBOL-land some problems get fixed up until today, but not fundamental language issues, nor community issues. Yes, I compare COBOL with PHP. Many, or most, languages will someday be 'legacy' languages. Some just a little sooner then others. :)
- Demiurge 13y agoI'm not sure why you're getting modded down, I think you make a very obvious point. There is a programming language (syntax) and there are libraries. PHP syntax is not informed by much of Computer Science of the 30 past years, and it can't be fixed, that would be a new language. Frameworks can evolve and as long as the syntax allows enough, can be as amazing as anyone bothers to engineer them. This has nothing to do with how good a language actually is.
- mjburgess 13y agoI'm as cutting edge in the PHP community as any is going to be (having used the latest betas & community-best-practices since 2004). I still have serious doubts about PHP, and always insist to new developers should learn a (ruby/python/... clojure/...) too. The main problem with PHP is the language itself. There is no paradigm it does well. If you're into class-ical OO, then the language's type system is a joke (esp. with the lack of co/contra-variance in type hinting). If you're into dynamic OO, PHP's java leg-humping perpetually gets in the way. There is no meta-classes, monkey patching, etc. everything that should be dynamic is static. If you wanting functional programming... you have nothing. Literally. The best they've been able to do is a half-baked closure system. Half the library uses references (rather than returning meaningful data) so you cannot compose functions and there is no hope for any kind of collections system (lists, arrays, etc.) that support a typical functional manipulation. All you're left with is a "dynamic C". Add to this that PHP is designed to terminate immediately... and you're modern "daemonic" web requirements (concurrency, queuing, etc.) are completely out of the window. From the point-of-view of "web-scale" application development PHP is a broken toy: both in the sense that talented developers are hampered by it, and in the sense that its execution model is ill suited to the problem.
- alien3d 13y agoJava->queuing->Just put sleep.. why so so hard ? with the lack of co/contra-variance in type hinting Write proper code oop and comment->Most latest ide can see it. Now php much okay with namespace.. only what i really wanted now is partial class.. Other no need..
- hrvbr 13y agoPlus there is PHP's aesthetics. I can't help but see all PHP code visually unpleasing. Programming isn't just a technical task. It's also an art like writing novels. I'm not satisfied when the code I produce doesn't look pretty, independently from the algorithm. In the article here, the Ruby code looks much cleaner to me than the PHP version, even though it's technically the same. Aesthetics is the main reason why I switched from PHP (that I learned in class) to C# (that I learned on my own).
- 13y ago
- yulaow 13y agoI was one of the php haters for a long time, then i discovered Laravel and it was mindblow. Maybe php stock is not that cool, but using a good framework (and now there are many) it becomes really awesome.
- aidos 13y agoI spent a couple of years with php recently. I was using Codeigniter as a framework. Php frameworks now compete with the rest and the language is as complete as most others. Setup couldn't be much easier and it's probably the most ubiquitous web language. It does, however, have some bad behaviours of out the box that promote bad app development. I was startled at the default error handling when I had to start using it again recently. It was a fight to get it to display errors - and stop executing - whenever something was wrong in the code. This is madness. If your code is broken, it should notify you. I tried doing the same thing to existing well known php apps. They wouldn't even load. That, for me, is the core issue. You have an ecosystem devoloped by people who seemingly don't even care if there are bugs in their code.
- kayoone 13y agoHm, might be your framework of choice then ? Symfony2 for example shows complete Stack Traces of Exceptions and has a very detailed debug panel
- jtreminio 13y agoYour framework may have been catching exceptions and continuing execution. If you want all errors displayed, you should tell PHP about it. In fact, it is recommended you display everything possible and code to strict standard while in dev. Doesn't sound like you were doing that.
- pillock 13y agoI wish people would stop trying to defend PHP against "the haters" - firstly because no amount of reasoned argument is going to change the views of fundamentalists, and secondly because they are a minority group whose opinions are unlikely to inhibit the rise of the PHP ecosystem.
- simonw 13y agoI would argue that the "rise of the PHP ecosystem" has been massively damaged by the amount that has been written about PHP's flaws. An ecosystem needs talented programmers working on open source libraries for that ecosystem, or helping spread best practices. You don't see much fresh innovation in the PHP community these days - instead, you see developers who work with PHP having to recreate libraries and techniques developed by other languages. Meanwhile, the Node.js, Python, Rails etc communities are overflowing with talented developers who used to work with PHP and are now busily inventing the future on top of different languages.
- orang55 13y agoI'd take issue with arguing that there isn't much innovation in the PHP community. It might not be the best language for every application (I find myself using it less and less these days), but there have been a whole ton of recent developments that have made it much nicer to work with. PHP 5.4 made some pretty significant improvements, and Laravel is one of the nicest full-stack frameworks I've ever worked with. PHP now has good/sane dependency management via Composer, and many of Laravel and Symfony's components can now be used outside of the main framework. Microframeworks are a pleasure to work with in PHP, which is especially nice for smaller one-off webapps. Many of the recent improvements have been (very) late to the game, but they're nevertheless welcome. I could do without the Java-esque levels of verbosity that PSR-0 encourages, but it does seem to result in highly-maintainable code. "New PHP" projects (written from scratch, targeting 5.3 and above) tend to be of surprisingly high quality. As I've mentioned before, Laravel emerged from nowhere as a lightweight and very high-quality framework, long after the PHP community had been declared moribund.
- PommeDeTerre 13y ago
- 10098 13y agoNew frameworks != improvement of the language. PHP was shit then and it's shit now. I earned my first money by writing things in that language and I'm very glad that I moved away from that particular technology and web development in general.
- jmcgough 13y agoWhen is "then"? I'm a rubyist, but I worked with PHP for a year and was impressed with how far the language has come in the last decade. Before PHP5 (2004ish), the language wasn't really even object oriented. In the last few years, PHP has gotten garbage collection, namespacing, native JSON support and others. I really dislike PHP as a language, but it's not fair to call it shit. The language is maturing.
- tzaman 13y agoI'd say one of PHP's biggest flaws is that it's just too easy to get started. One might argue that's not a flaw, but it is - it allows junior developers to dig right into the code without knowing the basics of how web works, in turn producing extreme technical debt and waste years on bad practices. I've been there too, and I must say I agree with Jeff on this matter - if I was forced to use Ruby instead of PHP when starting my career, I'd be a better developer today. But I'm catching up :)
- tux 13y agoI don't see anything good about Disclosure project. All it takes is disabling javascript and nothing works :-)
- eksith 13y agoIt's not fair that you can't see anything good about Discourse just because of the JS requirement. That's just one handicap. It has its good points and all of its current features can be implemented (and already has in other projects) with HTML fallback in PHP. But I feel the biggest problems Discourse is attempting to solve is sociological, not software based. Whether software can fix human nature is another topic altogether. Full disclosure: I don't use Discourse and don't plan to any time soon. I still believe any site/forum worth it's salt should be available via wget so that rules out most web apps (I don't believe a forum should be a web app).
- mojuba 13y agoI'm just wondering, why should it take 15 years to get operators [] and -> to work with any subexpression (and to my knowledge it's still not 100% there)? Shouldn't it be implied and kind of automatic in a programming language? Or why should it take 15 years to adopt [...] as an array constructor in a language where arrays are one of the central data structures? Here is opinion No. 823,664,783 about PHP from a long time PHP developer: it sucks (for me) because somehow I don't have a sense that the language itself is in good hands. I'm not sure if, say, they introduce a new basic operator in expressions and that it will not take another 15 years until it makes full programming sense.
- jtreminio 13y agoPHP Core is not some Mount Olympus, if you have C skills you can contribute!
- rizalp 13y agoIt is indeed in bad hands. No language designer / guru ever that I know ever come close to exploring its Good parts. I'm talking Anders Hejlsberg / James Gosling / Douglas Crockford level here...
- PommeDeTerre 13y agoI wouldn't say that Crockford really "explored JavaScript's good parts". Rather, he just covered parts of JavaScript that shouldn't be used, and whatever wasn't completely broken was considered to be "good". It isn't truly good, however. It's just not "severely bad" like the rest of JavaScript is.
- billpg 13y ago(snarky comment about equality operators goes here)
- PommeDeTerre 13y agoThere's nothing "snarky" about pointing out stupidly and inexcusably broken programming language features.
- kailuowang 13y agoThe code example he gave in ruby and PHP demonstrate perfectly that the PHP version is verbose (not to mention that the ruby code isn't the most concise one). It could be just me, who, as a develop, is sensitive to every single unnecessary characters in the code, which happens a lot in that couple lines of php code.
- memla 13y agoThat example is framework specific. Change the php framework to laravel and this: $topic = $this->get('model.Topic')->find($topic_id); $this->get('guardian')->ensureVisible($topic); becomes this: $topic = Topic::find($topicId); Guardian::ensureVisible($topic);
- apinstein 13y agoPrepare yourself for gross generalizations, but I have a point :) In 1997, people moved from perl to PHP in the same way that in 2004+ people moved from PHP to Ruby. At the time, the hard part of web programming was deployment, easy access to libraries of functions relevant for web programming, digesting forms, and emitting HTML. PHP suddenly made that trivial. PHP was basically a new language with a stdlib for web programming. It was enjoyable to work with, and it took off. Circa 2004, the hardest part of web programming was managing the DB from the app code (migrations,ORM), quickly accessing the prolific output of the OSS community (RubyGems), and having some sane organizing principles around building apps (opinionated MVC). In 2004 I had the same problems in my PHP apps. I had just come off of 2 years of Cocoa development and couldn't stand doing PHP the "old" way. It was too painful. I ended up porting the Cocoa framework to PHP so that I'd have a sane way of building apps. I later discovered ruby/rails, but frankly at that time it was less mature than my framework so I didn't jump. As someone stuck in PHP land, I was frustrated by the relative lack of progress in the PHP community vs Ruby, but I was never really enamored with Ruby the language. It's powerful, and easy to read, but frankly I felt that power would eventually work against it. As the less-savvy developers moved to it, the quality of the code would greatly diminish. I feel that this has happened. I do use a lot of Ruby projects as well, and it's rare that I don't run into critical bugs almost immediately. For as many nice things as there are about ruby, I find it very difficult to debug, and the broad application of metaprogramming, mixins, and other language tricks ends up delivering apps that have highly coupled state that fail in unpredictable, hard to debug ways. Javascript has the same problem. Frankly I don't think the ruby community is producing code of better quality than the php community at this point. There is great stuff that we can finally easily share thanks to composer. Metaprogramming & dynamism are neat ideas but I just don't think it scales well with the constructs that those languages have. PHP 5.4 has traits which are really nice for this type of thing, and Scala's traits are even nicer. The point being that other languages can deliver that flexibility without becoming unmanageable, and I don't think there's a path to that with Ruby or Javascript. IMO, I think languages like Ruby and Javascript will actually WANE in the far future as new languages come along with better constructs for empowering developers with dynamism that can be better managed and have faster runtime performance. I think Ruby will end up as a frowned-upon language with crap libraries and Javascript will more and more just be used as a build target.
- joeblau 13y agoOne of my main challenges with PHP is that it has no package manager with large community support. With npm and gem, and the community supporting them - developers get so much help in building robust products. Every developer that I've known for a few years and successfully switched from PHP to Node has said "Why didn't you tell Me about this before?!"
- memla 13y agoComposer/Packagist[1] is exactly like npm. It's even mentioned in the article. [1]: https://packagist.org/ https://packagist.org/
- jtreminio 13y agoThis is exactly the problem with so many HNers - they have no idea what they're talking about. 5 years ago, you may have been right. Now? You are so wrong. Before bashing something, you should make sure you're correct.
- usamec 13y agoOk, PHP got package manager and MVC frameworks, but half of problems mentioned here http://me.veekun.com/blog/2012/04/09/php-a-fractal-of-bad-design/ http://me.veekun.com/blog/2012/04/09/php-a-fractal-of-bad-de... are still not fixed. It's shitty language and package manager and MVC will not help.
- rizalp 13y agoPHP as a language is broken. I don't want to speak in broken language. It hurts my brain as human.. Unlike other popular language which has language designer around it, PHP 'copy' other language feature without even serious consideration around it. Even more, there are no language guru who want to research the Good parts of it, like Javascript who has Douglas Crockford who tels us the good parts...
- rartichoke 13y agoI started with php and never used a framework quite some time ago. Every web site/app I've built had different file structures and my own little twists on how to abstract away certain things. I rarely used any third party php code too but my code slowly improved on its own. Now a days I use rails and prior to that I used node/express for a year or so. I think working with php made me a better developer because you need to learn from your mistakes and using bare bones php is the best way to ensure you make mistakes. You don't really understand why things are done a certain way until you've experienced first hand at how horrible it is to maintain a 6,500 line php file that's mixed with sql, php, html and a ton of inline css in a project that has about 500kb of mixed php/html/css files and like 30 different dynamic pages.
- krapp 13y agoYou don't really understand why things are done a certain way until you've experienced first hand at how horrible it is to maintain a 6,500 line php file that's mixed with sql, php, html and a ton of inline css in a project that has about 500kb of mixed php/html/css files and like 30 different dynamic pages. It's quite possible to write PHP applications which aren't that terrible, tightly coupled or unmaintainable. Perhaps you can blame PHP's low bar for entry for making those kind of bad practices possible, but it's not as if the language requires you to work that way. Although I do see that kind of thing a lot in Wordpress, still.
- rartichoke 13y agoYes I know but if you want to pickup "web development" as a beginner then chances are you're going to start with PHP unless you are getting trained by someone who happens to be using a different technology. At least that's how it was back in 2006ish when I started. Its low barrier of entry is exactly why it's easy to make mistakes. You are given 5000 functions and no guidelines other than the ones you make yourself.
- krapp 13y agoIt's still bad, and there's a lot of bad legacy PHP code out there, but I don't believe it's as bad as it was. Although most new developers working with PHP will probably be hacking wordpress themes and plugins (which don't really have much in the way of best practices other than WP's sometimes infuriating API and mixins as a feature) but others will still end up using a framework like Symfony or Laravel, or Composer to manage dependencies and autoloading. I don't know if it's even as common as it was to start in PHP without at least touching some kind of framework... although that's just an assumption on my part. At the very least there's a lot more good PHP code out there and better practices to be found, even if education seems like a dauntless task.
- sergiotapia 13y agoPHP is like that old phillips screwdriver you have in your toolbox. You know, the one with a crack going down the side of the handle. Wrapped in masking tape to keep the thing together. You bought it when you moved into your first house and you need to screw a lighting fixture that was about to fall off the wall. It's been with you for years, always there in case something needed a little tightening. Sure you have better, more streamlined tools in your shed, but sometimes you just need a little elbow grease and your old pal the screwdriver.
- toupeira 13y agoReminds me of this glorious quote from http://me.veekun.com/blog/2012/04/09/php-a-fractal-of-bad-design/ http://me.veekun.com/blog/2012/04/09/php-a-fractal-of-bad-de...: "I can’t even say what’s wrong with PHP, because— okay. Imagine you have uh, a toolbox. A set of tools. Looks okay, standard stuff in there. You pull out a screwdriver, and you see it’s one of those weird tri-headed things. Okay, well, that’s not very useful to you, but you guess it comes in handy sometimes. You pull out the hammer, but to your dismay, it has the claw part on both sides. Still serviceable though, I mean, you can hit nails with the middle of the head holding it sideways. You pull out the pliers, but they don’t have those serrated surfaces; it’s flat and smooth. That’s less useful, but it still turns bolts well enough, so whatever. And on you go. Everything in the box is kind of weird and quirky, but maybe not enough to make it completely worthless. And there’s no clear problem with the set as a whole; it still has all the tools. Now imagine you meet millions of carpenters using this toolbox who tell you “well hey what’s the problem with these tools? They’re all I’ve ever used and they work fine!” And the carpenters show you the houses they’ve built, where every room is a pentagon and the roof is upside-down. And you knock on the front door and it just collapses inwards and they all yell at you for breaking their door. That’s what’s wrong with PHP."
- unz 13y agoThe best web platform is haskell and postgres, or ocaml-java/yeti and mysql on appengine. Phpers and rubyers are missing out on the most delightful and least error-prone ways to use functional and relational programming.
- inthewind 13y agoThe thing that irritates me the most with Php, is not being able to quickly jump around the code from class to class without some hack. While magic autoloaders are great my IDE/text editor isn't smart enough to know how to do this. You could probably write some code to help in this respect for your editor or use some other tools. It ultimately ends up that I want to hold too much of the project in my head, which is a brain muck. I personally recommend Python over Php to newcomers because I think it's an easier language to understand and get going with.
- krapp 13y agoI would suggest that this in particular is a problem with your workflow and IDE/editor and not PHP. I've usually just kept everything open as a project in Sublime Text, works just fine. As far as the code itself goes, using PSR-0 and/or Composer makes most of the headaches with class loading just go away.
- inthewind 13y agoI agree about that PSR-0 and using Composer helps. But sadly not all code is written that way.
- vijayr 13y agoCan anyone recommend a good PHP framework? I've used Zend and Yii - they are okay, but I'd like to try something new. So, other than these two, which ones are good?
- krapp 13y agoLaravel 4 http://laravel.io http://laravel.io for large dependency heavy projects, Slim Framework http://slimframework.com http://slimframework.com as a microframework.
- orang55 13y agoMany of Laravel's components can also be stripped out and used as microframeworks. Their database ORM is particularly nice, and I use it alongside Slim on a few projects. From my experience using it, Laravel also feels a lot "lighter" than the other big frameworks of the past. It's a bit less opinionated, and it's much easier to get set up and running.
- throwaway420 13y agoI think many developers on here evaluate programming languages solely based on technical merits without considering business needs. PHP's sweet spot currently makes it the wisest choice for many small business projects. When you're talking about any project that's less than a thousand lines of code or so, PHP's weaknesses don't really present a major problem and its strengths (ease of deployment, ease and ubiquity of hosting, having a bunch of necessary features for websites from DB access to email built into the language) are ideal for smaller organizations, particularly those without a full-time technical staff. Think about how many small businesses out there (restaurants, real estate agents, a simple online store) just need 1 or 2 basic dynamic elements (simple DB access, a contact form, some validation on an order form, maybe sending a confirmation email on a sale) on their website to work to enhance their business. PHP is a great choice for these types of projects - a good portion of non-technical small businesses don't need anything more elaborate than this. I wouldn't recommend PHP for large or ambitious projects, as other alternatives like Node and Rails are likely better fits. But when you have a very simple small business project, PHP is by far the best choice for a lot of these types of projects.