Hacker News new | past | comments | ask | show | jobs | submit login

The fact that PHP is hated by anyone who learned PHP and moved onto other, ostensibly better things is the reason why all the hate exists.

Given any programming task, you're just going to end up with better code in pretty much any other language, especially a functional one.




As someone who has worked with php over 9 years, I can confirm this. I think beginners should not be, under any circumstances, suggested to start with PHP.

I shudder when thinking about the damage that showing == vs === stuff (PHP's type coercion rules, in general) to someone new to programming! It is such a waste to force someone new to learn a bunch of edge cases and weird behaviors and an endless list of php lol's that literally have zero value outside the context of PHP.


> Given any programming task, you're just going to end up with better code in pretty much any other language, especially a functional one.

This is the exact bull* that good hearted Haskell and Lisp guys have to face and fix because of arrogant people like you.

First of all, a good PHP programmer is a good programmer. End of story. You can write crystal clear code in PHP that anyone who started with C (how many I wonder?) or a C inspired language can read. Spreading information and knowledge IS FAR MORE IMPORTANT than debating the language.

Let me ask you a question, did you just happen to read that post that was recently on the front page of HN? The one that showed how much awesome is Lisp comparing to Python? How Python's creator seems to hate Lisp (functional programming)? Did you read it and got to the conclusion that since (perhaps) you are using a functional language then you are entitled to spew crap like that since you are the holder of truth?

Congratulation! PHP is worse than a functional language (you can write functional code in Python and PHP btw) and you are the winning lord of programming languages debates!


> because of arrogant people like you

> you are entitled to spew crap like that since you are the holder of truth?

We ban users who address other users repeatedly like this, so please don't do it again on HN. Comments here must be civil and substantive.

https://news.ycombinator.com/newsguidelines.html


Of course HN will always be biased towards followers of the hive. Don't worry, I won't be coming back. ;)


> This is the exact bull* that good hearted Haskell and Lisp guys have to face and fix because of arrogant people like you.

No. It is not. It takes a lot more effort to produce the code of same quality in php. For one thin, you have to consider that one has to keep and endless list of gotchas and edge cases (yes, all languages have these, but the list is nowhere near as long as it is in php) in mind when writing any amount of php code.

>You can write crystal clear code in PHP that anyone who started with C..

tell me, what does this code do, in php?

$a = array('1' => 'one');

What is the value of $a after this statement?

Answer: It appears that it is creating a dictionary with a string key that maps to another string value, but instead it creates a numerically indexed array with value 'one' stored at numeric index 1.

Do you call this 'Crystal clear'?

PHP is a language that breaks the principle of least surprise at every turn. Please don't say you can write crystal clear code in it, if you are actually interested in spreading information and knowledge, as you put it.


Isn't the word 'array' quite obvious that it will create an array? Since PHP 5.4 you actually have the shorthand "[]" version available but it is still obvious to anyone who is using PHP or JavaScript (though JS arrays aren't hash maps like PHP's -- you need an object for that).

But I agree, it's crystal clear for anyone with a minor PHP knowledge. For the rest it's just "clear". (It will still work calling $a['1'] with the quotes so what exactly is the issue? If you mean the drawbacks of type coercion not sure if this example is the best one.)


>It will still work calling $a['1'] with the quotes so what exactly is the issue?

Oh yea. Try this.

    $a = array ('1' => 'one');

    foreach ($a as $k=>$v) {

    if ($a === '1') {

      echo "found one";

    }

    }
Surprise! Never prints "found one".

THAT is the issue! I used '===' so I should be safe from type coercion issues, right? Well, a hidden rule in php says no.

See this bug..oops feature, when it bit even experienced php programmers here

https://www.reddit.com/r/PHP/comments/2zhg6z/how_true_is_thi...

See that post and the comment from the user e-tron. Both of them who are experienced php programmers


from that post:

> Bad idea? Sure. But once you know the enemy you can deal with it

Why surround yourself with more enemies than those that inherently exist in your business logic/problem domain? The problem with PHP is all of those "no big deal tiny issues" add up to something reminiscent of death by 1000 papercuts.


A correction. it is

    if ($k === '1') instead of if ($a === '1')..


> arrogant people like you

I spent 5 years working with ASP (very similar to PHP especially in the ability to create spaghetti code). In PHP's defense, I wrote an eBay-like site in one night using it. I also know Lisp, some Haskell, BASIC, Pascal, spent 10 years (!) on Ruby, know Clojure, Erlang, JS...

I think I know my shit, I'm 43 and have been basically coding since I was 12 on a Commodore PET... And although PHP lets you get something up quick... It will always be a challenge to create a team-maintainable codebase with it.

PHP doesn't even pass its own test suite. And they do not realize why this is bad? This is the hallmark of hubris.

It's not "arrogance" you're seeing, man. It is the cold hard weight of experience building and maintaining large codebases for years in various languages.




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: