r/programming • • Dec 02 '15

PHP 7 Released

https://github.com/php/php-src/releases/tag/php-7.0.0
887 Upvotes

729 comments sorted by

View all comments

69

u/[deleted] Dec 02 '15 edited Dec 02 '15

I'm currently at the first first job I've had to do some PHP work.

It was quite painful at first, but it grew on me over time.
Does the language have issues? Oh dear god, yes it does. However, I was expecting it to be truly terrible given the amount of hate it receives, and it's really not as bad as all that.

57

u/mgkimsal Dec 02 '15

i worked with a php-skeptic who warmed to it after a few months. "Meh, it's not really all that bad once you get in to a groove".

Conversely, I've found the hype around the 'trendy' stack (rails years ago, node today) is the reverse. Sort of like "meh, it's not all that great when you get down to it - not bad, but not a life saver"

12

u/ksion Dec 02 '15

It's almost as if not everything people write on the internet was true, eh?

→ More replies (9)

8

u/glemnar Dec 02 '15 edited Dec 02 '15

I think the actual biggest downsides are that debugging and testing even locally are slowwwwwwwwwww. Xdebug over network calls is my nightmare, and the amount of boilerplate needed to write assertions in phpunit on stubs is dreadful. Not to mention mocking out function calls that aren't class methods is pretty much untenable.

Dropping a trace and running arbitrary code in python? Crazy easy, works everywhere without setup. Watch expressions? Terrible. : (

→ More replies (2)

27

u/longshot Dec 02 '15

There is a lot of inconsistency in the api. Things like needle and haystack being the first or second arguments interchangeably gets maddening. Sometimes snake case, sometimes camel case, sometimes just lowercase. That stuff gets annoying.

But if that is what drives you away from a useful language then there's a lot more about programming that is going to be painful than PHP.

Plus, I'm a PHP developer but I still wind up writing 3 times as much JavaScript just to push the frontend around.

6

u/philsown Dec 02 '15

Functions are case-insensitive in PHP, if that helps.

→ More replies (1)

5

u/bowersbros Dec 02 '15

The needle haystack thing sort of makes sense.

They are at least consistent within their subgroups.

Array functions have 'needle' first, and string functions have 'haystack' first.

13

u/[deleted] Dec 02 '15

IMO, php gets a bad rap from being a "starter" language for a lot of people getting into web-dev.

I can't think of anything that's easier to get started with server-side than PHP (most servers support it and it's pretty much naming a file .php and adding a couple code tags). Since it's a common starter language, it also means that beginners will be dealing with a lot of new things - not just PHP things. However, since PHP is the language of the time - they associate PHP with there problems, not them being new programmers.

It seems like once people are starting to get proficient with PHP, they start to discover the world of Rails, Python, Node/JS, etc. They move onto "greener pastures" with a bunch of knowledge they didn't have to start PHP. They have less "issues" with Rails, Python, etc - not because they're "better" languages, but because they know how to deal with common issues.

9

u/[deleted] Dec 02 '15

I also think part of the issue with PHP is having been around for 20 years there's a lot of code on google that will come up that simply won't work.

I bet if I google "how to connect to a database in PHP" I'll get answers from 2001 or whenever that literally just won't work in modern versions of PHP. This causes people to get mad at the language for "not working".

→ More replies (3)
→ More replies (6)