Why is PHP being made fun of?

  • (2 Pages)
  • +
  • 1
  • 2

20 Replies - 2342 Views - Last Post: 04 March 2015 - 07:31 PM

#1 kathy025  Icon User is offline

  • D.I.C Head

Reputation: 39
  • View blog
  • Posts: 175
  • Joined: 19-December 14

Why is PHP being made fun of?

Posted 01 March 2015 - 06:48 AM

I'm just learning PHP in my Web Programming class. Reading up articles on different languages, PHP seems to be the butt of memes and jokes.

I'm just curious as to why?
Is This A Good Question/Topic? 0
  • +

Replies To: Why is PHP being made fun of?

#2 Atli  Icon User is offline

  • Enhance Your Calm
  • member icon

Reputation: 4238
  • View blog
  • Posts: 7,216
  • Joined: 08-June 10

Re: Why is PHP being made fun of?

Posted 01 March 2015 - 07:32 AM

PHP is in a group of wildly successful languages; languages used on a massive scale. But among that group, it is one of the more different. Those that specialize in the others - especially those from the more traditional strongly-typed OOP based languages (Java, .NET, C++) - like to consider themselves above PHP developers, and as such tend to band together to bash PHP whenever they get a chance.

That's not to say some of the things they say aren't valid; PHP definitely has it's issues.

However the memes and the random bashing is usually just down to good old fashion school-yard bullying; making themselves feel superior by making the most different kid on the playground look inferior.
Was This Post Helpful? 0
  • +
  • -

#3 ryemck  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 45
  • Joined: 16-November 14

Re: Why is PHP being made fun of?

Posted 02 March 2015 - 10:11 AM

I love php :D haters gonna hate I guess!
Was This Post Helpful? 0
  • +
  • -

#4 andrewsw  Icon User is offline

  • lashings of ginger beer
  • member icon

Reputation: 6336
  • View blog
  • Posts: 25,545
  • Joined: 12-December 12

Re: Why is PHP being made fun of?

Posted 02 March 2015 - 10:23 AM

I like PHP ;)

wikipedia

Quote

PHP is a server-side scripting language designed for web development but also used as a general-purpose programming language.

One criticism of PHP is that it was not originally designed, but instead it was developed organically;[16] among other things, this has led to inconsistent naming of functions and inconsistent ordering of their parameters.[17] In some cases, the function names were chosen to match the lower-level libraries which PHP was "wrapping",[18] while in some very early versions of PHP the length of the function names was used internally as a hash function, so names were chosen to improve the distribution of hash values.

PHP wasn't intended to be a general-purpose language, so it is unfair to compare it directly to, say, Java or C#. It is really a domain-specific language.



Quote

Early PHP was not intended to be a new programming language, and grew organically, with Lerdorf noting in retrospect: "I don’t know how to stop it, there was never any intent to write a programming language […] I have absolutely no idea how to write a programming language, I just kept adding the next logical step on the way."

This post has been edited by andrewsw: 02 March 2015 - 10:30 AM

Was This Post Helpful? 0
  • +
  • -

#5 jon.kiparsky  Icon User is offline

  • Screw Trump (before he screws you)
  • member icon


Reputation: 10622
  • View blog
  • Posts: 18,176
  • Joined: 19-March 11

Re: Why is PHP being made fun of?

Posted 02 March 2015 - 11:05 AM

Frankly, PHP is simply not a pleasant language for programmers. For most programmers who come to it from other languages, working in PHP is one long facepalm moment. It's the death of a thousand cuts - not one big bug, but a thousand little easter eggs of failure. This is well cataloged in many places, and it's not some sort of bullying - it's just the fact of the matter. If you're used to responsible languages, PHP is painful.
This is largely due, as noted, to the fact that the language was never designed. I see that there are efforts to remedy this, but it seems to me that it's a case of "too little, too late". We'll see, though. There's also the simple matter of "first-mover disadvantage" - PHP was the first language to target the web in a serious way, and they got to make all of the mistakes. Everyone who mocks PHP is doing it with the significant advantage of having seen and learned from all of the ways you can fail at doing this. So there's a sense of "more to be pitied than scolded" here.

There's also the unfortunate fact that, for various reasons, most of the PHP that you find in the wild was not written by very good programmers, so anyone who's had the pleasure of going in to work on existing PHP has an endless supply of "WTF" moments to recount. This is made worse by the fact that the first things most people wrote tend to be the stuff that's the most embedded in their codebase, and hence the hardest to root out or change. (particularly since PHP, especially the older stuff, is not easy to refactor - again, this goes back to the lack of language design)

Anyway, having just done a round of job-search, I can tell you that when I told recruiters I was interested in "anything but PHP", I got two reactions. First was "yeah, we hear a lot of that". Second was "don't worry, we're not seeing anyone looking for PHP programmers these days". So for what that's worth... I don't think we'll see PHP disappear, but I don't see it being an important language going forward. It's done its work, but its work is done.
Was This Post Helpful? 0
  • +
  • -

#6 kathy025  Icon User is offline

  • D.I.C Head

Reputation: 39
  • View blog
  • Posts: 175
  • Joined: 19-December 14

Re: Why is PHP being made fun of?

Posted 03 March 2015 - 12:26 PM

Thanks for your responses.

I'm mainly a Java developer since my degree has most units in Java. I've done a couple of JavaEE projects using Struts2.

In the short time I've developed in PHP, I must say I was surprised with the "liberties" of the language, like the "oh-that's-allowed-in-PHP" moments, whereas Java will not. This, I find more of a disadvantage than an advantage though.

There was also one time I went round and round with a machine problem. Turns out, 0 == null in PHP which was causing the havoc. I find it odd though, null is an unknown value and 0 is a value.

We're barely through the PHP basics, but I do like the associative array. :)
Was This Post Helpful? 0
  • +
  • -

#7 andrewsw  Icon User is offline

  • lashings of ginger beer
  • member icon

Reputation: 6336
  • View blog
  • Posts: 25,545
  • Joined: 12-December 12

Re: Why is PHP being made fun of?

Posted 03 March 2015 - 12:44 PM

There is a falsy table here. It might be more confusing than helpful.

The falsity of values and expressions is not as clear cut in PHP as it is in other languages. (In Javascript practically anything that is zero, empty, false, etc., is false.)

I wouldn't attempt to memorize all the variations, just be aware that this is a potential gotcha.

View Postkathy025, on 03 March 2015 - 07:26 PM, said:

We're barely through the PHP basics, but I do like the associative array. :)

Array functions (array_walk and many others) are quite powerful.
Was This Post Helpful? 0
  • +
  • -

#8 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 4123
  • View blog
  • Posts: 13,011
  • Joined: 08-June 10

Re: Why is PHP being made fun of?

Posted 03 March 2015 - 12:45 PM

View Postandrewsw, on 03 March 2015 - 08:42 PM, said:

(In Javascript practically anything that is zero, empty, false, etc., is false.)

an empty object in JS is still true. (arrays are a bit wonky here)

This post has been edited by Dormilich: 03 March 2015 - 12:59 PM

Was This Post Helpful? 1
  • +
  • -

#9 andrewsw  Icon User is offline

  • lashings of ginger beer
  • member icon

Reputation: 6336
  • View blog
  • Posts: 25,545
  • Joined: 12-December 12

Re: Why is PHP being made fun of?

Posted 03 March 2015 - 12:53 PM

I was thinking of an empty string.. but I was exaggerating for effect :)

This post has been edited by andrewsw: 03 March 2015 - 12:56 PM

Was This Post Helpful? 0
  • +
  • -

#10 andrewsw  Icon User is offline

  • lashings of ginger beer
  • member icon

Reputation: 6336
  • View blog
  • Posts: 25,545
  • Joined: 12-December 12

Re: Why is PHP being made fun of?

Posted 03 March 2015 - 12:58 PM

I said (momentarily!) that an empty array is false:
[] == false // true

but this isn't accurate. A better test is:
var x = [];
if (x) console.log("it's true");

This post has been edited by andrewsw: 03 March 2015 - 12:59 PM

Was This Post Helpful? 0
  • +
  • -

#11 Christopher.Burkhouse  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 20
  • Joined: 03-March 15

Re: Why is PHP being made fun of?

Posted 04 March 2015 - 12:13 AM

The problem with many users of whom I shouldn't mention, is they are in a pretentious "I'm better than you" attitude.

Let me expand on that.

One of the first things I learned as a developer was that most languages force you to initialize variables. PHP does not. So you could simple say...

<?php 
$var1 = 'this is a string variable'; 
$var2 = 5; // this is an integer variable
?>

Why is this a problem? It really isn't. However, the 'proper' way to do this (and I can't disagree to be honest) is to initialize the variable and it's type. So...
int a = 5

This would be 'more proper.' Additionally, most programming languages force you to initialize variables at the top of the code, while with php you could go...
<?php echo 'hello there'; $var = 'oh what is this.'; echo $var; ?

But how dare I initialize a variable after a print to screen!! Heathen!! It's just a different language. A different way.

Now just because PHP has their own way of doing it doesn't mean their way is wrong. They allow you to convert variable types, set variable types, etc. But because it's different, several narrow minded users will say it is wrong. It's not that their way is wrong, it's rather different. Is it the BEST way? Not really. It's their way.

Now one of the things you will hear as well is PHP has a lot of security holes. Not true. Anyone who says this uses the excuse for their lack of programming knowledge. MySQL (replaced by MySQLi in PHP5 or 4, I can't remember) is the greatest offender. However, these security holes were intentionally in place to allow flexibility in the code. If all data was properly validated, there was a zero chance of vulnerability. Blaming the code is simply easier.

I mean, the short answer is, as other stated, PHP is different. They've come a long way, and kept some non-traditional pieces. If someone doesn't like it, good for them.

BTW, jon.kiparsky, please refrain from false information. PHP is one of several languages. In the workplace, a lot of companies use Windows servers... and if you've ever tried to install Apache/PHP on a Windows server... it's gotten easier since but wow. I remember back in my days I was asked to install Apache/PHP instead of IIS on their Windows server. I don't know why they needed this to be done but it was silly and unnecessary. Anyways, since the corporate world tends to use Windows server more often than not, you're skewing your facts a little it would seem. PHP is still a very desirable language in the right setting. In my experience with PHP, ASP, JS, Ajax, C, C#, ASP, and some odd Android off-language, PHP is very different. Just because you don't like it doesn't mean it's not a good language.

But by all means, if any of the above is wrong, please correct me. Bias aside, I think the original poster wants facts over opinion (:

-Chris
Was This Post Helpful? 0
  • +
  • -

#12 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 4123
  • View blog
  • Posts: 13,011
  • Joined: 08-June 10

Re: Why is PHP being made fun of?

Posted 04 March 2015 - 12:20 AM

Quote

But by all means, if any of the above is wrong, please correct me.

AJAX is not a language.
Was This Post Helpful? 0
  • +
  • -

#13 Christopher.Burkhouse  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 20
  • Joined: 03-March 15

Re: Why is PHP being made fun of?

Posted 04 March 2015 - 12:33 AM

I never did specify programming languages, but I guess it was implied a bit :P/> My bad lol. However, it's Ajax, not AJAX ;)/>

This post has been edited by Dormilich: 04 March 2015 - 12:35 AM

Was This Post Helpful? 0
  • +
  • -

#14 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 4123
  • View blog
  • Posts: 13,011
  • Joined: 08-June 10

Re: Why is PHP being made fun of?

Posted 04 March 2015 - 12:35 AM

you write abbreviations not all-uppercase?
Was This Post Helpful? 0
  • +
  • -

#15 Christopher.Burkhouse  Icon User is offline

  • New D.I.C Head

Reputation: 1
  • View blog
  • Posts: 20
  • Joined: 03-March 15

Re: Why is PHP being made fun of?

Posted 04 March 2015 - 12:47 AM

View PostDormilich, on 04 March 2015 - 12:35 AM, said:

you write abbreviations not all-uppercase?


I was more or less making a joke here as it's very controversial and not for this thread (as we'd be going WAY off topic). Essentially the meaning behind the abbreviation was lost, thus coining Ajax as a name rather than it's initial, outdated abbreviation. But there's a lot of silly controversy over which one SHOULD be used. BUT I was being silly. Truthfully, I don't care lol. To me, Ajax is AJAX and AJAX is Ajax. The wiki goes over the coining of Ajax, as well as a few internet articles.
http://en.wikipedia....x_(programming)

As far as PHP goes, I totally forgot to mention that they've been adding a TON of features. One note that PHP was criticized for was no OOP features. This was introduced in PHP5. MySQLi was also introduced in PHP 4.1. It may have been intended for much smaller purposes, but it's come a long way. People can make fun of it all they want, but I still have a lot of fun with the language. (yes, this was my lame way to get back on topic, I apologize for that misstep).

-Chris
Was This Post Helpful? 0
  • +
  • -

  • (2 Pages)
  • +
  • 1
  • 2