News for hackers. Stuff that matters.
Re:PHP functions originally bucketed by strlen, were renamed... by mistercow on Monday December 16, 2013 @09:32PM (#6919248)
Sometimes I feel like Rasmus Lerdorf is going to come clean one bright April Fools' Day, and reveal that PHP was just a hilarious joke that sort of got out of hand.
Re:PHP functions originally bucketed by strlen, were renamed... by gst on Monday December 16, 2013 @09:56PM (#6919311)
I like his quotes:

> I'm not a real programmer. I throw together things until it works then I move on. The real programmers will say "yeah it works but you're leaking memory everywhere. Perhaps we should fix that." I'll just restart apache every 10 requests.

> I was really, really bad at writing parsers. I still am really bad at writing parsers. We have things like protected properties. We have abstract methods. We have all this stuff that your computer science teacher told you you should be using. I don't care about this crap at all.

(from http://axonflux.com/5-quotes-by-the-creator-of-php-rasmus-le...)

Re:PHP functions originally bucketed by strlen, were renamed... by GhotiFish on Tuesday December 17, 2013 @01:07AM (#6919814)
In a very strange way, I respect this man.
Re:PHP functions originally bucketed by strlen, were renamed... by jtreminio on Monday December 16, 2013 @09:41PM (#6919273)
Yeah! Haha the joke's on Facebook, Wikipedia, Flickr, Yahoo! Answers, Photobucket, Digg (RIP), etc ... Those fools have been using a joke language and didn't even know it!

Seriously, the PHP hate gets old. It started off very much as a scratch to one man's itch. That man wasn't the best programmer ever (wouldn't even say top 10%, or even close), but he had an idea and executed it to make one of the most successful free products ever that has generated billions and billions of dollars for the world economy.

Can you say the same?

Re:PHP functions originally bucketed by strlen, were renamed... by MichaelGG on Tuesday December 17, 2013 @01:21AM (#6919845)
Joke is sort of on them. Every single article I've read with engineers at the big sites talking about PHP mainly deals how to get around PHP. All of the things PHP is lauded for making things "easy" are the exact things the big sites go out of their way to avoid.

Those sites are popular in spite of PHP, not because of it. If Mark had been proficient in ASP instead of PHP, FB would probably be running .NET. It's not like anything early FB did was particularly impressive and relied on special language features. (Correct me if I'm wrong.)

Re:PHP functions originally bucketed by strlen, were renamed... by 0x0 on Tuesday December 17, 2013 @02:26AM (#6919980)
On the other hand, what about time-to-market and worse-is-better and good-is-the-enemy-of-perfect? Could it be other efforts in the same space failed (and you never even heard of them) because they wanted to do things "right"?
Re:PHP functions originally bucketed by strlen, were renamed... by MichaelGG on Tuesday December 17, 2013 @02:43AM (#6920018)
That's more happenstance of what happened to be on-hand. It's unlikely using, say, ASP with VBScript, would have generated any sort of "better-is-worse" type scenario.

A Windows 2000 server with IIS/ASP installed had the same time-to-market advantage as PHP.

Re:PHP functions originally bucketed by strlen, were renamed... by mehwoot on Monday December 16, 2013 @10:21PM (#6919396)
that has generated billions and billions of dollars for the world economy.

That's an interesting thought. Has it? I wonder what a lot of websites would have used if PHP has not been around. I wonder if, overall, PHP existing has actually generated billions and billions of dollars in value.

Re:PHP functions originally bucketed by strlen, were renamed... by jmccree on Tuesday December 17, 2013 @12:27PM (#6922323)
I can't say whether something else wouldn't have replaced PHP eventually, but I can say PHP definitely played it's part in making the web we know today. Back in the day, say circa 2000, unless you were wealthy/lucky enough to have your own server around, if you wanted a website you were stuck with shared hosting.

Many of us "web devs" were running desktop windows and had never even used a *nix command line or studied programming beyond BASIC. CGI (perl) scripts were absolutely painful to install, much less write. Dealing with stdin just to get post variables? Python and Ruby were rarely supported as CGI, and there were likely no web frameworks back then that you could manage to install on a shared account. Besides, a lot us back then weren't programmers to being with, we just wanted a web site to scratch an itch. Programming was a means to an end, and I think the rasmus quotes support that.

Enter PHP(&mod_php). Open up your FTP client, rename index.html to index.php, edit to add Hello <?=$name?>, load up index.php?name=Bob in IE, see "Hello Bob", MIND BLOWN! PHP was easy to use, learn, and it came with a huge function library built in. It was a sandbox to play in. The barrier of entrance difference between cgi/perl and PHP was like GIMP to Windows Paint.

The number of web scripts available to use exploded after PHP hit the scene. Message boards, calendars, photo galleries, shopping carts, etc. Sure, a lot of the code written was horrible by today's standards, or even CS standards of then, but that's not the point. Websites were launched, communities were formed, products were sold. Sure phpBB, wordpress, and others code was not properly engineered, but where would the web be without the communities and blogs they allowed to form?

Facebook started on shared PHP hosting. The mediawiki script was created because Magnus Manske wanted to try out PHP. Yahoo actually chose PHP to replace their in-house scripting language over ASP, Coldfusion, and other proprietary options when using open source was a huge risk. Python and ruby were not even on the web radar when yahoo chose PHP. [1]

Now today we may look at the code derived from the era before python, ruby, svn, github, cheap easy VPS/VM access, when shared web hosting was the only PaaS, and look in horror, but the fact remains that PHP powers 75% or more of all websites on the internet today.[2][3]

To ask if PHP has generated value, is to ask if Windows has generated value. They may have been ugly, but they got us where we are today, and the PHP of today is not the PHP of 2000.

[1] http://public.yahoo.com/bfrance/radwin/talks/yahoo-phpcon200... [2] http://venturebeat.com/2013/05/17/google-app-engine-finally-... [3] http://w3techs.com/technologies/overview/programming_languag...

Re:PHP functions originally bucketed by strlen, were renamed... by protomyth on Monday December 16, 2013 @10:30PM (#6919434)
Not sure what they would have used because it seems like no other language makes it quite as easy to install and start using. I get the feeling a lot of language designers don't really get that some poor sap has to get the language installed on the web server.
Re:PHP functions originally bucketed by strlen, were renamed... by felipellrocha on Monday December 16, 2013 @10:51PM (#6919524)
Any of the myriad of good languages available out there? Php is only easy to install because it comes pre-installed in most low-end servers out there. Without that fact, php is just as cumbersome to get started as any other language.
Re:PHP functions originally bucketed by strlen, were renamed... by protomyth on Monday December 16, 2013 @11:09PM (#6919582)
"Php is only easy to install because it comes pre-installed in most low-end servers out there. Without that fact, php is just as cumbersome to get started as any other language."

It comes installed because it is easy to install. Someone had to install it and PHP is sure easy for any SysAdmin to get installed. It is easy to start because the PHP folks made it easy to get started.

Look at the steps to get PHP installed versus other languages. Then look at what "Hello World" and a simple form take.

Re:PHP functions originally bucketed by strlen, were renamed... by fuzzix on Tuesday December 17, 2013 @03:19AM (#6920097)
> "Look at the steps to get PHP installed versus other languages"

Not much different to getting CGI working. If you need it working well, FastCGI is as much effort as PHP-fpm. SUexec is as much effort as SUPHP.

Any language could supplant PHP in terms of ease of deployment, there's little out there that doesn't have some CGI library to handle the mucky parts.

Not that I am advocating use of CGI for anything non-trivial.

Re:PHP functions originally bucketed by strlen, were renamed... by weland on Tuesday December 17, 2013 @03:43AM (#6920149)
> Look at the steps to get PHP installed versus other languages. Then look at what "Hello World" and a simple form take.

That's really just not true. Installing anything capable of CGI is as easy to install as PHP.

Re:PHP functions originally bucketed by strlen, were renamed... by protomyth on Tuesday December 17, 2013 @08:22AM (#6920944)
It seems many hosting companies or their sysadmins don't agree since PHP gets installed and Ruby, etc. doesn't. PHP is an easy to install module and very easy to do the first program since its just a part of the webpage.

If you want your favorite language to replace PHP, then you have to make it easy for the sysadmin to install (preferably 1 line) and for new programmers to be able to use the language by just uploading a file.

Re:PHP functions originally bucketed by strlen, were renamed... by jmccree on Tuesday December 17, 2013 @10:55AM (#6921756)
Yeah, but PHP use as CGI was likely never more than 1% of the market. What most people mean is installing mod_php is easier than setting up another language via cgi or fastcgi.
Re:PHP functions originally bucketed by strlen, were renamed... by bch on Monday December 16, 2013 @11:46PM (#6919670)
> just as cumbersome to get started as any other language.

Any other language that has dedicated .INI files to determine its behaviour, maybe. PHP caught on because of "Hello world" in a web browser, and smart people didn't realize the value of novelty.

Re:PHP functions originally bucketed by strlen, were renamed... by Killswitch on Monday December 16, 2013 @11:36PM (#6919644)

    sudo apt-get install apache2 php5 libapache2-mod-php5
Boom, I just installed PHP5 on Apache on Ubuntu, now I just upload a file to my project root.

Let me know when you find any way easier than that.

Re:PHP functions originally bucketed by strlen, were renamed... by felipellrocha on Tuesday December 17, 2013 @12:09AM (#6919702)
Meanwhile, Python comes already installed by default in most linux distributions. So, forget .ini files, forget apache until deployment time(hell, don't be forced onto apache if you don't want to. Choose whichever deployment server you want. I know... options... it's weird... you'll get used to it), forget worrying about php upgrades on shared machines, forget that apt-get line. .py file, and you're up and running (and headache-less).
Re:PHP functions originally bucketed by strlen, were renamed... by emilv on Tuesday December 17, 2013 @01:40AM (#6919888)
I have a fresh install of such a distro, where Python is included. What do I need to do to from Python present an input form which takes my name and a second page that greets me using the same name? Including deployment of course, how else should I test it without paying a web host?

I'm not discussing headaches, I do nit particularly like PHP. My point is just that Python is not very easy to get started with for beginners.

Re:PHP functions originally bucketed by strlen, were renamed... by Shish2k on Tuesday December 17, 2013 @04:19AM (#6920232)

  import web
          
  urls = (
      '/(.*)', 'hello'
  )
  app = web.application(urls, globals())
  
  class hello:        
      def GET(self, name):
          if name: 
              return 'Hello, ' + name + '!'
          else:
              return "<form><input name='name'></form>"
  
  if __name__ == "__main__":
      app.run()
upload into your web server's cgi-bin folder, or have the server configured to exec all *.py files as python

ED> yeah, this is a few more lines of code than PHP and it requires a teeny tiny amount of knowledge about how the web works - and that "takes 5 minutes to get started" vs PHP's "takes 2 minutes to get started" is a big difference for someone who doesn't know what they're doing but wants results immediately :P

EDED> Actually now that I think about it, that's how /I'd/ start a simple webapp as it has the structure in place to grow easily and elegantly -- if you're willing to do things the quick and dirty way, you can go without a framework and just print an HTTP response to stdout - in which case the only difference with PHP is that the python version requires "print 'Content-type: text/html\n'" at the top

Re:PHP functions originally bucketed by strlen, were renamed... by emilv on Tuesday December 17, 2013 @05:38AM (#6920420)
I certainly do agree that this somewhat more abstract approach is much better for stable web applications. My point is that PHP doesn't require you to understand anything to get started, which explains its widespread usage. That is of course not true if you want security or maintainability, but that is exactly the snake oil sold by PHP.

But this web framework is much newer than PHP, isn't it? And this does not look better or easier than PHP: https://wiki.python.org/moin/CgiScripts

Re:PHP functions originally bucketed by strlen, were renamed... by Shish2k on Tuesday December 17, 2013 @06:46AM (#6920605)
> And this does not look better or easier than PHP: https://wiki.python.org/moin/CgiScripts

That has tracebacks on error and HTML escaping, so I'd say it's considerably better for a tiny increase in difficulty (but you're right that no matter now tiny the difference, PHP is still easier)

Re:PHP functions originally bucketed by strlen, were renamed... by protomyth on Tuesday December 17, 2013 @01:06AM (#6919812)
I think your missing the point, what comes in a Linux distribution is irrelevant. What comes installed from a hosting company is what matters, and since PHP is easy for a SysAdmin to install it was installed. Choice is often limited by the host.
Re:PHP functions originally bucketed by strlen, were renamed... by felipellrocha on Tuesday December 17, 2013 @11:29AM (#6921972)
Most hosts out there offer linux as their main platform? Plus, installing python with apt-get is not much more difficult than php. One liner, minus the .ini configuration stuff.
Re:PHP functions originally bucketed by strlen, were renamed... by protomyth on Tuesday December 17, 2013 @04:43PM (#6924165)
"apt-get is not much more difficult than php"

Nope, I install PHP and then upload a page with PHP embedded and it works. It is not that easy with python. That's why all these hosting accounts had LAMP and not something else.

Re:PHP functions originally bucketed by strlen, were renamed... by felipellrocha on Tuesday December 17, 2013 @09:53PM (#6925610)
What happened to context? The guy above me clearly said he used apt-get to install php. You're gonna have to install php somehow, whether you're gonna use apt-get or not is your decision, but whichever way you choose, apt-get or make, the difficulty is about the same.
Re:PHP functions originally bucketed by strlen, were renamed... by protomyth on Tuesday December 17, 2013 @10:24PM (#6925705)
The difficulty isn't the same because installing python doesn't install any web server integration. That's the point.
Re:PHP functions originally bucketed by strlen, were renamed... by jtreminio on Monday December 16, 2013 @11:40PM (#6919652)

    php5
installs apache, by default.
Re:PHP functions originally bucketed by strlen, were renamed... by Killswitch on Monday December 16, 2013 @11:46PM (#6919669)
Good to know, I haven't used Apache in a while. I normally use Nginx, but that's not quite as easy to get up and running because you got to set PHP5-FPM sockets in your virtual host. ;)
Re:PHP functions originally bucketed by strlen, were renamed... by bhauer on Tuesday December 17, 2013 @12:47AM (#6919780)
There's the rub, really. I have been fascinated by how quickly the "it's so easy to install" mantra is replaced with "only a noob would use those settings, let me link you to a detailed guide on how you should really use PHP," at which point it becomes more complicated to install than alternatives.

I am not a fan, so I am biased. But I've never quite seen the appeal of such a superficial attribute as "it's already on my cheap server." Are we not programmers? How hard is it, really, to install a JVM, Python, Ruby, Go, or any other platform? It's never taken me more than scarce minutes. To my mind, it seems widespread delirium prioritizing such a non-priority over peace of mind and performance. It's akin to selecting an operating system based on the fonts it ships with.

Re:PHP functions originally bucketed by strlen, were renamed... by jarek on Tuesday December 17, 2013 @01:33AM (#6919876)
> But I've never quite seen the appeal of such a superficial attribute as "it's already on my cheap server." Are we not programmers?

Most people who start out programming PHP aren't programmers. (I think that's a good thing FWIW.) The ease to non-programmers explains the wide spread which is what the discussion is about.

Re:PHP functions originally bucketed by strlen, were renamed... by trentmb on Tuesday December 17, 2013 @02:54AM (#6920046)
./golang_app.bin
Re:PHP functions originally bucketed by strlen, were renamed... by yen223 on Monday December 16, 2013 @10:38PM (#6919461)
If people adopted a better-designed language, maybe that could have generated trillions and trillions of dollars for the economy.
Re:PHP functions originally bucketed by strlen, were renamed... by protomyth on Monday December 16, 2013 @10:49PM (#6919510)
We had better designed languages. The problem is getting them installed and easy of learning. The better designed languages weren't better in those areas.
Re:PHP functions originally bucketed by strlen, were renamed... by 2muchcoffeeman on Tuesday December 17, 2013 @12:37AM (#6919757)
Oh the other hand a company like Facebook uses it and then they have to resort to developing Hip Hop to wring out more performance.
Re:PHP functions originally bucketed by strlen, were renamed... by thezilch on Tuesday December 17, 2013 @02:17AM (#6919965)
On the other hand, they have to resort to writing it in X and probably having a smaller and more expensive pool of talent to pull from. Not to mention, it may have never been a product to begin with or come to fruition fast enough under a different language. I guess everyone should be writing in C, in the event they get to Facebook scale where the economies tip towards running in a faster runtime? Oh wait, there are plenty of C haters, too; let's go shopping!
Re:PHP functions originally bucketed by strlen, were renamed... by bermanoid on Tuesday December 17, 2013 @04:35AM (#6920278)
And plenty of companies move away from Python and Ruby once they hit "own our own data center" scale, too. You only optimize once it's worth it.
Re:PHP functions originally bucketed by strlen, were renamed... by knieveltech on Tuesday December 17, 2013 @02:26AM (#6919983)
Perl.
Re:PHP functions originally bucketed by strlen, were renamed... by eru on Monday December 16, 2013 @10:27PM (#6919421)
Perhaps not in value, but in GDP?
Re:PHP functions originally bucketed by strlen, were renamed... by Iftheshoefits on Monday December 16, 2013 @09:56PM (#6919312)
Arguments from popularity can be amusing when laden with sarcasm, but that doesn't make them valid arguments.

I'd say PHP is and has been popular more because it's easy to hire an army of self-trained "php developers" for peanuts than because it is a "good" language.

Re:PHP functions originally bucketed by strlen, were renamed... by eksith on Monday December 16, 2013 @10:09PM (#6919353)
I'd argue that PHP has been popular because it makes hiring a developer optional for the vast majority of folks who want to put up a website. In the days before Facebook et al. Your options were Geocities and family or a cheap shared host with apache and PHP3-4. When the most sophisticated portions of a site were a gallery and contact form, the "put files here, done" methodology is pretty hard to beat.

It being a "bad language" is irrelevant for someone who's end result requirement is a functional page over technological purity.

Disclosure: I develop mainly in C#

Re:PHP functions originally bucketed by strlen, were renamed... by Iftheshoefits on Monday December 16, 2013 @10:48PM (#6919503)
I don't think we're saying different things. :)
Re:PHP functions originally bucketed by strlen, were renamed... by judk on Monday December 16, 2013 @10:41PM (#6919474)
Facebook itself was PHP website thrown together without design!
Re:PHP functions originally bucketed by strlen, were renamed... by knieveltech on Tuesday December 17, 2013 @02:40AM (#6920012)
There was a time (and it wasn't terribly long ago) that "self trained" developers garnered additional respect in the community because they had the sand to go in and learn a system under their own power instead of having concepts spoon-fed to them in class. Academically trained developers were known first and foremost for over-engineering otherwise simple tasks and typically required two to four years in industry to break of bad habits.
Re:PHP functions originally bucketed by strlen, were renamed... by saraid216 on Wednesday December 18, 2013 @02:08AM (#6926279)
> Arguments from popularity can be amusing when laden with sarcasm, but that doesn't make them valid arguments.

Informal fallacies don't automatically invalidate the argument either. Informal fallacies are rhetorical red flags: they predict problematic logic, because they're generally used in place of actual logic: but unless you're talking about formal fallacies, the argument can still be valid.

In this case, it depends entirely on whether or not you accept popularity as a valid metric for success or quality or whatnot: you're arguing whether or not the "P -> Q" premise is true or false, not whether or not the argument itself is valid. Because P is true.

Re:PHP functions originally bucketed by strlen, were renamed... by freshhawk on Tuesday December 17, 2013 @01:41AM (#6919891)
Crack cocaine is a very successful product that has generated billions and billions of dollars for the world economy.

You have to watch out for arguments from popularity, they don't prove or even suggest anything other than popularity.

Re:PHP functions originally bucketed by strlen, were renamed... by cmelbye on Monday December 16, 2013 @09:44PM (#6919283)
Does the fact that it's used by large websites change the fact that it's a poorly designed language?
Re:PHP functions originally bucketed by strlen, were renamed... by unavoidable on Monday December 16, 2013 @09:48PM (#6919291)
Does the fact that it's a poorly designed language change the fact that it's a useful one?
Re:PHP functions originally bucketed by strlen, were renamed... by code_duck on Tuesday December 17, 2013 @12:55AM (#6919793)
Being poorly designed changes the extent to which it is useful.
Re:PHP functions originally bucketed by strlen, were renamed... by cmelbye on Monday December 16, 2013 @09:51PM (#6919301)
No.
Re:PHP functions originally bucketed by strlen, were renamed... by koide on Monday December 16, 2013 @09:54PM (#6919308)
No, but it certainly puts the importance of good language design in perspective.

We tend to overvalue good design just for good design's sake.

Re:PHP functions originally bucketed by strlen, were renamed... by mikeash on Monday December 16, 2013 @10:01PM (#6919329)
It puts the importance of good language design in perspective in two completely different ways, though!

You're completely correct, but at the same time, PHP also stands as a stark warning not to throw things together with no design, lest your misshapen child end up being immortalized.

PHP is simultaneously the best-case outcome and the worst-case outcome for a badly designed language.

Re:PHP functions originally bucketed by strlen, were renamed... by MichaelGG on Tuesday December 17, 2013 @02:46AM (#6920024)
In what perspective? PHP doesn't have to bear the weight of many other programmers dealing with their suboptimal design decisions.

A popular DB had an intentional feature that lost data on 32-bit builds. You might not get bitten until you've gotten plenty of data in it - it's still a terrible design that hurts everyone.

Re:PHP functions originally bucketed by strlen, were renamed... by Yver on Monday December 16, 2013 @10:00PM (#6919323)
You'd have to qualify what "poorly designed" means or even what language you're talking about. In that mail, Lerdorf recounts his time writing PHP/FI nearly twenty years ago. It's like judging the current Linux kernel based on the early version Linus Torvalds was using in his lab around the same time.
Re:PHP functions originally bucketed by strlen, were renamed... by tptacek on Monday December 16, 2013 @10:11PM (#6919363)
The filesystem layout on Linux was never pessimized in order to work around using string length (STRING LENGTH) as a hash function.
Re:PHP functions originally bucketed by strlen, were renamed... by shoyer on Monday December 16, 2013 @10:11PM (#6919364)
...except PHP still has htmlspecialchars as a core library function. If Linux ever had these some of warts, they were resolved long ago.
Re:PHP functions originally bucketed by strlen, were renamed... by ars on Tuesday December 17, 2013 @01:08AM (#6919817)
No they weren't. Go look at the TTY driver if you need an example. Any place you interface with user code you are stuck.
Re:PHP functions originally bucketed by strlen, were renamed... by mistercow on Monday December 16, 2013 @11:20PM (#6919612)
I'm not really making any strong comment about PHP's usefulness or anything. I'm just saying that many of the things that have happened in its development would sound like they came right out of the manual for INTERCAL, except that they're too over the top.

As for its popularity, well, that would be the "got out of hand" part.

Re:PHP functions originally bucketed by strlen, were renamed... by eevee on Monday December 16, 2013 @10:54PM (#6919537)
Conversely, I wonder how much time/money has been spent porting away from PHP, or working on stuff like hiphop?

I don't have an estimate, but it's an interesting question if you're going to argue in terms of economic impact.

Re:PHP functions originally bucketed by strlen, were renamed... by kailuowang on Monday December 16, 2013 @10:01PM (#6919327)
I don't know if you can say that "those fools have been using it and don't even know it." It's hard to tell if they had a time machine would they go change that decision (to use php). Anyway I agree that there has already been too much time spent on this language, no need to waste more beating the dead horse.
Re:PHP functions originally bucketed by strlen, were renamed... by jfb on Monday December 16, 2013 @10:30PM (#6919435)
Who cares? It doesn't make the language any better.
Re:PHP functions originally bucketed by strlen, were renamed... by PavlovsCat on Monday December 16, 2013 @10:51PM (#6919522)
And who cares about that, in turn? It's just the glue you write your data structures, objects and functions in. You can still write shitty code in a nice language, and you can architect something well thought out in BASIC.

A nice language makes for shorter, more expressive code, sure, but that's like having a fast car that handles well; it still matters more where you're driving it. If someone is making a trip with a caravan of a million rust buckets to a nice place, why would they care about some Porsche owner moaning about how that is all so very wrong?

If PHP developers complained all the time about how programming sucks, then you could maybe tell them to use a better language. But the PHP devs aren't really complaining, rather people who aren't even using it.

People use Wikipedia. I dare say Wikipedia improved a lot of lives a lot. Meanwhile, a gazillion static blog generators written in hip language of the day prove no real benefit over notepad, or this textarea right here. It's like making a trip with a handful of people to a place that's been explored by others decades ago, and then being bitter that nobody cares, and hating on the roaring party going on next door.

If you want to make language A or B more popular and better accessible when it comes to web hosting, write the killer app in it that nobody can do without, and which can't be implemented in PHP. That should be simple, since PHP sucks so much, right?

Lastly, is the HN code nice? I wouldn't even know, it's that irrelevant. The HTML it puts out sure is atrocious, but even that doesn't matter.

Re:PHP functions originally bucketed by strlen, were renamed... by felipellrocha on Tuesday December 17, 2013 @12:46AM (#6919779)
> A nice language makes for shorter, more expressive code, sure, but that's like having a fast car that handles well; it still matters more where you're driving it.

An f1 racer driving an f1 car will always beat another f1 racer driving a beetle.

Plenty of killer apps use other languages- Instagram, Pinterest, Quora, and Youtube, for example. Google certainly wasn't written in php.

Matter of fact is, facebook has spent millions of dollars trying to change languages, trying to make php behave, trying to make php faster. Wikipedia is nice, but I bet they'd be able to serve even more people if they based used a better language.

HN code is probably nice. The HTML is just the surface of the architecture sites like these run upon.

Re:PHP functions originally bucketed by strlen, were renamed... by PavlovsCat on Tuesday December 17, 2013 @02:35AM (#6920001)
> An f1 racer driving an f1 car will always beat another f1 racer driving a beetle.

Which is nice when you're having a race, but rather useless when you don't.

> Plenty of killer apps use other languages- Instagram, Pinterest, Quora, and Youtube, for example. Google certainly wasn't written in php.

Those are't apps in the sense that you can install and modify them, are they. The fact that youtube exists does nothing to drive Python adoption. Sure the same can be said for Wikipedia, but not for MediaWiki.

Re:PHP functions originally bucketed by strlen, were renamed... by deoxxa on Tuesday December 17, 2013 @05:39AM (#6920422)
There are... Just so many open source web applications that aren't written in PHP. So, so many.
Re:PHP functions originally bucketed by strlen, were renamed... by felipellrocha on Tuesday December 17, 2013 @11:41AM (#6922041)
>> An f1 racer driving an f1 car will always beat another f1 racer driving a beetle. >Which is nice when you're having a race, but rather useless when you don't. I was driving a point using the analogy previously used. I think trying to write a php app is like trying to drive a beetle, when you could be using a transformer- It's a robot when you need it to be a robot, and it's a car when you need it to be a car.

> Those are't apps in the sense that you can install and modify them, are they. >The fact that youtube exists does nothing to drive Python adoption. Sure the same can be said for Wikipedia, but not for MediaWiki.

If you're gonna say that about youtube, the same should be said about Facebook. With python, at least we have Django, Pyramid, Bottle, Flask. All of which are good open-source platforms that allows you to quickly get a web project going(not just a wiki), and which do a lot to drive Python adoption.

> There are... Just so many open source web applications that aren't written in PHP. So, so many. That was just an example of apps written in python. The comprehensive list is much, much larger (though I thought that was implied).

Re:PHP functions originally bucketed by strlen, were renamed... by mistercow on Monday December 16, 2013 @11:14PM (#6919596)
>And who cares about that, in turn?

Anyone who has to maintain bad PHP code, for starters.

Re:PHP functions originally bucketed by strlen, were renamed... by Killswitch on Monday December 16, 2013 @11:42PM (#6919659)
I see more people complaining about maintaining bad code in other languages than I do about maintaining bad code in PHP. I personally have been a PHP developer since 2001, I haven't maintained any bad code... Actually, I spent a good portion of my early career completely rewriting shitty PHP code to be good PHP code.
Re:PHP functions originally bucketed by strlen, were renamed... by eropple on Monday December 16, 2013 @11:49PM (#6919676)
> I haven't maintained any bad code...

>I spent a good portion of my early career completely rewriting shitty PHP code to be good PHP code.

I'm curious what you think maintenance is.

Re:PHP functions originally bucketed by strlen, were renamed... by Killswitch on Monday December 16, 2013 @11:50PM (#6919679)
Rewriting the system from the ground up, not maintaining the current code base. Sorry I wasn't so exact on that.
Re:PHP functions originally bucketed by strlen, were renamed... by cpeterso on Tuesday December 17, 2013 @01:14AM (#6919833)
Code maintenance (of good code or otherwise) is a sign of success. Rewriting everything is not.
Re:PHP functions originally bucketed by strlen, were renamed... by PavlovsCat on Monday December 16, 2013 @11:20PM (#6919610)
If any other programming language was as popular, there would be just as much bad code in it. Nothing about PHP forces you to write bad code, nothing about other languages forces you to write good code.

Also, if PHP is really just sucky and offers no advantages, why not simply rewrite it in a better language? Surely the costs would ammortize quickly.

Re:PHP functions originally bucketed by strlen, were renamed... by mistercow on Monday December 16, 2013 @11:32PM (#6919635)
I don't dispute that people will write bad code in any language. The problem I have with PHP is that it at best, makes it exceedingly easy to write bad code, and at worst has actually encouraged it (see, for example, magic quotes).

I also am not claiming that PHP offers no advantages. Certainly it has some good things about it. The choice to allow you to easily interleave PHP code with HTML is an example of a simple feature which makes life really easy when you're setting up a site.

But rewriting in a better language is not necessarily a viable option. It's generally not the call of the person tasked with maintaining it, and even if it is, "cost will amortize quickly" isn't necessarily good enough on a large project with limited funding.

Re:PHP functions originally bucketed by strlen, were renamed... by jtreminio on Monday December 16, 2013 @11:37PM (#6919646)
> actually encouraged it (see, for example, magic quotes).

Actively discouraged for years, and removed completely over a year and a half ago.

Re:PHP functions originally bucketed by strlen, were renamed... by mistercow on Monday December 16, 2013 @11:41PM (#6919656)
Yes I know, I was just pulling out a random example that came to mind. Still, you'll find a lot of code out there running on old versions of PHP with magic quotes enabled.

And that's another part of the problem: the incorporation of really bad ideas that end up poisoning code bases for years to come, simply because they weren't properly vetted before being released.

Re:PHP functions originally bucketed by strlen, were renamed... by nivla on Monday December 16, 2013 @11:29PM (#6919631)
I find comments like these interesting and at the same time ironic, especially on a sites like HN. I could think of 10 reasons why PHP is the "wrong" language but I could also think of 100 reasons why it made a successful one. Rasmus my not have created a perfect language but he sure did create one heck of a successful one which even the "elitest"/"perfect" language are still trying to catch upto.

Never belittle other's work, especially when striving to discover that magic formula to success. All the posts on HN about "How we made X successful" and we brush off the obvious ones in front of our eyes? Ever stopped to think why a crappy X is popular? Maybe there is something to it.

Also not to mount on irony but keep in mind, you are commenting on a site that has the HTML syntax from the Geocities era (it has its reasons though).

Re:PHP functions originally bucketed by strlen, were renamed... by MichaelGG on Tuesday December 17, 2013 @02:50AM (#6920037)
Can you explain how, in any possible universe, using strlen as a hash function and choosing function named to bin on length in any way helps PHP, at all?
Re:PHP functions originally bucketed by strlen, were renamed... by GhotiFish on Tuesday December 17, 2013 @05:20PM (#6924401)
well I can think of a reason you might do that. It's dead simple, and you can easily predict the distribution, so you can choose names that have a relatively good distribution. Sure your first few buckets go empty, but at that point, you're overthinking it, NEXT SECTION!
Re:PHP functions originally bucketed by strlen, were renamed... by GhotiFish on Tuesday December 17, 2013 @01:11AM (#6919825)
I would be very interested to hear those reasons.
Re:PHP functions originally bucketed by strlen, were renamed... by pessimizer on Thursday December 19, 2013 @11:29AM (#6935620)
1. mod_php

2. ...

Re:PHP functions originally bucketed by strlen, were renamed... by GhotiFish on Thursday December 19, 2013 @12:07PM (#6935945)
php prevents you from having a good page structure?

I'm no fan, but that's going a bit far, don't you think? What's a rickety syntax and inconsistent naming have to do with page design?

Re:PHP functions originally bucketed by strlen, were renamed... by themodelplumber on Monday December 16, 2013 @09:42PM (#6919276)