Hacker News new | ask | show | jobs
by JelteF 4618 days ago
There is a lot more wrong with PHP than these (anti-)features. It's loose comparisons for instance, with gems like 0 == "php" returning true, but 0 == "1" returning false [1] [4]

Having a function like nl2br [2], which converts newlines to br tags. The only reason this function would be useful is when you want text to HTML. The problem is, this requires a lot more than just replacing newlines with br tags.

A function like intval [3], which according to the documentation when passed a string "will most likely return 0".

And just about anything on http://www.phpwtf.org/

My main point is, that PHP is not broken because of these features. PHP is broken because the language has been hacked together from the start and there is no way to guess what built in functions will do if you haven't looked up the full documentation for them first.

[1]: http://www.decontextualize.com/wp-content/uploads/2010/01/ph...

[2]: http://php.net/manual/en/function.nl2br.php

[3]: http://php.net/manual/en/function.intval.php

[4]: http://i.imgur.com/pyDTn2i.png

1 comments

All languages have odd quirks. One can cherry pick from any of them: https://www.destroyallsoftware.com/talks/wat
PHP is built on odd quirks. that's the difference.

It's only popular because it's easy to setup shared apache+php hosts and deploy scripts via FTP on it.

Yes, only ;)