21 ms·
PHP has a lot of functions that actually take away lots of pain, but you have to know they're there. If only this fellow had found implode(), he wouldn't have
by randallsquared 18y ago
PHP has a lot of functions that actually take away lots of pain, but you have to know they're there. If only this fellow had found implode(), he wouldn't have needed to write enumerate().
I was a PHP hater for years, but I find that for certain types of problems, it really is the right solution.
[Edit, later: and you can (and should) paper over some of his other complaints. PHP isn't a great language qua language, but it has such great penetration that it almost doesn't matter.]
- jamesbritt 18y ago"I was a PHP hater for years, but I find that for certain types of problems, it really is the right solution." Can you give some examples of those certain types of problems?
- randallsquared 18y agoSure. Social networking sites like the one in my user profile. Pretty much any site where the building of the site would be fairly trivial in any language, and scaling is the problem: with PHP, you can start it on any cheap host and port it in minutes to better servers, because you don't have to worry so much about setup. If the idea itself is innovative, but there's nothing interesting about the code that the site runs on, PHP is an excellent candidate. I've built sites (some for clients, some of my own) in a bunch of languages, and there's a certain amount of tradeoff between setup/installation and actual coding. For whatever reason, languages which are more fun or more productive to code in require more setup time, and are likely to be already installed on a random new server almost exactly in reverse proportion with how fun/productive they are. It's eerie.
- jrockway 18y agoPretty much any site where the building of the site would be fairly trivial in any language, and scaling is the problem: with PHP, you can start it on any cheap host and port it in minutes to better servers, because you don't have to worry so much about setup. Aren't most PHP apps dependent on weird php.ini settings? And anyway, the "real" langauges are equally easy to deploy. Get yourself a $20 slicehost account (to start with), add two lines to apache's config to enable FastCGI, then just copy your app up to that server. That's all there is to deploying Perl, Ruby, and Python these days. With Perl and Catalyst, I can "make catalyst_par" and get a file that contains the entire application; including the version of Perl I am developing with. That way I know for sure it will work when I copy it to production. (Yes, this means I have to use the same architecture for both development and deployment. I do.)
- randallsquared 18y agoWeird php.ini settings can almost always still go in the directory with the php files, so just copying the directory automagically makes everything work right. Some settings don't work this way, of course, but I'm not sure which those would be, offhand. If you're using Python, for example, you're probably also using some framework... for years I used Webware for Python, and more recently web.py. Both require careful attention to get working in a convenient fashion, in my opinion.
- jamesbritt 18y ago" That's all there is to deploying Perl, Ruby, and Python these days." And scaling with those languages is a solved problem.
- nir 18y ago>Can you give some examples of those certain types of problems? Wikipedia, Flickr, Facebook, Wordpress... ;) Seriously though - in the real world, language strengths and weaknesses are very different from CS theory or discussion such as this one. PHP's popularity in itself has serious benefits: - You can pretty much install PHP anywhere because no host can afford not to support it well. - It will usually scale pretty decently and work reasonably well with your DB, OS and web server out of the box, because it has enough users that it got tested in many edge case installations. - Finding code is easy, and usually a new API provider will have a PHP library soon enough, if they want to get their API widely used. - Last but certainly not least - it's easier to find competent PHP coders than almost any language. There are a lot of incompetent ones and, as in any language, few excellent ones, but there's a larger base of competent-enough coders than Python or Ruby (or Lisp ;)) In my opinion most criticism of PHP misses the point. No question PHP is not an elegant language. By the same token, you could say Esperanto is far more clean than English, French more elegant and Italian more beautiful. But in the end, English is the one that's used.
- dcurtis 18y agoI've found that my limited PHP knowledge has been great for little tiny projects. For example, something like http://soindie.com http://soindie.com (which isn't mine) would be a huge pain to set up with some enormous framework. But with a few lines of PHP, a mysql database, and you're done.
- jamesbritt 18y ago"would be a huge pain to set up with some enormous framework." It is possible to write Web apps in Ruby, Python, et al without some enormous framework. They all have basic DB wrapper libs and straightforward templating tools.