Hacker News new | ask | show | jobs
by djsumdog 2938 days ago
You can write clean code in any language, and I've written some nice PHP, but the language itself has many fundamental design problems. For example, printf shouldn't have side-effects on a datetime object:

https://bugs.php.net/bug.php?id=75232

I run some OSS stuff on PHP, but in containers to keep it all isolated. Although things have gotten better with PHP7, knowing what I know about the language makes me hesitant to use it on any new project for anything except the most trivial systems.

1 comments

That should definetly be fixed, but it's not something people will ever experience unless they try to write broken code by using undocumented features/sideeffects.

What exactly is it you know about the language that makes you hesitant to use it?

It's type system and automatic casting/comparing is a nightmare.

Although there are namespaces now, the idea of everything being in the global scope was insane (and still even with namespaces, much is still in the global scope).

mysql_real_escape_string

There are no type-safe comparisons for greater or less then (You have ===, but no <== or >==).

This article: https://eev.ee/blog/2012/04/09/php-a-fractal-of-bad-design/

This subreddit: https://reddit.com/r/lolphp

The number of bugs that are closed as not-a-bug/wontfix.

I'm not sure how much of this has been fixed, but I've moved on to different languages and career choices and don't really want to look back that way.