Why is PHP being made fun of?

  • (2 Pages)
  • +
  • 1
  • 2

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

#16 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 - 01:48 AM

Oh god I was wrong but I'm willing to admit it. I wish these forums had an edit button. The technology (or technologies, whatever you want to call it) was originally coined as Ajax without the uppercase, thus the controversy. Tonight is not a good night for me.
Was This Post Helpful? 0
  • +
  • -

#17 Dormilich  Icon User is offline

  • 痛覚残留
  • member icon

Reputation: 4138
  • View blog
  • Posts: 13,073
  • Joined: 08-June 10

Re: Why is PHP being made fun of?

Posted 04 March 2015 - 01:50 AM

Quote

I wish these forums had an edit button.

they have, depending on your post count (AFAIK at least 15) with a varying time period where you can edit.
Was This Post Helpful? 1
  • +
  • -

#18 andrewsw  Icon User is online

  • say what now
  • member icon

Reputation: 6408
  • View blog
  • Posts: 25,888
  • Joined: 12-December 12

Re: Why is PHP being made fun of?

Posted 04 March 2015 - 03:39 AM

View PostChristopher.Burkhouse, on 04 March 2015 - 07:13 AM, said:

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.'

This is because PHP is a dynamic, weakly-typed language, as are many others. I don't think many criticise PHP because of this. If they do, then they have a problem with dynamic typing in general, rather than with PHP specifically. (Although some may criticise PHP for the way dynamic typing is implemented.)

View PostChristopher.Burkhouse, on 04 March 2015 - 07:13 AM, said:

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; ?

AFAIK there are only a few languages that force variables to be initialized at the top of the code. Certainly not most languages.
Was This Post Helpful? 0
  • +
  • -

#19 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 04 March 2015 - 04:57 AM

What's most criticized about PHP's variables is the type-juggling. That's something that developers from other languages have a hard time getting comfortable with.

I'm personally not a big fan of the type-juggling either. If there was one feature I'd radically change - were I to fork PHP myself - then that would be it. That, and standardizing the built in function/class libraries.

The weak vs strong typing argument is neither here nor there. A lot of great languages allow dynamic typing. Even some traditionally strongly typed languages, like C#, include some dynamic typing features now. (It's still strongly typed, it just doesn't force the type to be declared explicitly.)

Also, as I understand it, the Java VM now includes support for dynamic typing, although the Java language itself doesn't use it. (Yet?)
Was This Post Helpful? 0
  • +
  • -

#20 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 04 March 2015 - 05:03 AM

View PostChristopher.Burkhouse, on 04 March 2015 - 07:47 AM, said:

One note that PHP was criticized for was no OOP features. This was introduced in PHP5.

Technically PHP 4 also supported some OOP features, though they were rather poorly conceived.
PHP 5 redid that in a much much better way, though.
PHP 5.3, in particular, made a huge difference, when it introduced namespaces.
Was This Post Helpful? 0
  • +
  • -

#21 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 - 07:31 PM

View Postandrewsw, on 04 March 2015 - 03:39 AM, said:

View PostChristopher.Burkhouse, on 04 March 2015 - 07:13 AM, said:

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.'

This is because PHP is a dynamic, weakly-typed language, as are many others. I don't think many criticise PHP because of this. If they do, then they have a problem with dynamic typing in general, rather than with PHP specifically. (Although some may criticise PHP for the way dynamic typing is implemented.)

View PostChristopher.Burkhouse, on 04 March 2015 - 07:13 AM, said:

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; ?

AFAIK there are only a few languages that force variables to be initialized at the top of the code. Certainly not most languages.

It could be a local thing, because I've heard it more in person than over the nets. People would argue that forced variable types are better because you are more in control of the variable type and its data. Sure I agree, but that doesn't make other methods better. Oh and don't forget that by forcing initialization at the beginning of the code, it feels more organized. Different =/= better, but both definitely have their pros and cons. Thanks for the correction though, I thought forced var types was popular. I guess it's just popular among the languages I've learned... my bad lol.

View PostAtli, on 04 March 2015 - 04:57 AM, said:

What's most criticized about PHP's variables is the type-juggling. That's something that developers from other languages have a hard time getting comfortable with.

I'm personally not a big fan of the type-juggling either. If there was one feature I'd radically change - were I to fork PHP myself - then that would be it. That, and standardizing the built in function/class libraries.

The weak vs strong typing argument is neither here nor there. A lot of great languages allow dynamic typing. Even some traditionally strongly typed languages, like C#, include some dynamic typing features now. (It's still strongly typed, it just doesn't force the type to be declared explicitly.)

Also, as I understand it, the Java VM now includes support for dynamic typing, although the Java language itself doesn't use it. (Yet?)

Interesting. But as far as type-juggling, I totally understand you there. It was weird for me to go from PHP to C/C# for that reason. A part of me loved it, and another hated it. Honestly, I see both for their pros/cons. One has more flexibility, and another feels more organized/controlled (in my opinion). I mean... both can be a pain in the ass too.

View PostAtli, on 04 March 2015 - 05:03 AM, said:

View PostChristopher.Burkhouse, on 04 March 2015 - 07:47 AM, said:

One note that PHP was criticized for was no OOP features. This was introduced in PHP5.

Technically PHP 4 also supported some OOP features, though they were rather poorly conceived.
PHP 5 redid that in a much much better way, though.
PHP 5.3, in particular, made a huge difference, when it introduced namespaces.

Okay I did some research and good catch! It was actually added to PHP 3 and improved in PHP4, but then object handling was completely rewritten for PHP 5. I had no idea it was even there until PHP 5 since everyone made a big deal out of it being reworked.

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

  • (2 Pages)
  • +
  • 1
  • 2