Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

This has been my experience too. Ten+ years ago I had already concluded that the biggest problem PHP has is the community. Googling for "php mysql" you still end up on w3schools and the like where SQL injection is still not emphasized. Everyone was making their own frameworks and software from scratch. My last foray into PHP, and my realization that it's not actually all bad, was working in Zend Framework (iirc this was also when Ruby on Rails was fairly new and gaining popularity fast).

I haven't touched it (beyond very basic edits on my website, wordpress etc) for over a decade, but recently I inherited an older codebase at my new job. The existing codebase is an absolute mess, worse than the shit posted in those tutorials I mentioned.

But as part of the job (beyond rebuilding the application), I also had to add a big new feature to the application, a REST API. Keep in mind that due to constraints on the systems we install on, it had to be made in PHP 5.2 or 5.3 - one difference being that the older version doesn't even support an array creation shorthand (`$var = []`).

I could keep interactions with the existing codebase to a minimum. The rest was... actually surprisingly all right, thanks to me knowing what a REST API is and how to structure an application properly.

I did have to basically write my own framework (sigh) because pretty much nothing is still available that works on pre-array-shorthand-versions of PHP, but it was fairly minimal; an off-the-shelf router and URL matcher (can't be arsed with writing that myself), middleware for authentication, and a simple class structure to encapsulate different output formats (json, csv, streaming plain text).

Granted, this old version of PHP is seriously rough around the edges, and at the time it already represented great advancements in the language. I mean before 5.4 the language didn't even have a function to set the HTTP response code (you had to write the header manually).



Thanks, that made me smile. I got out of php a few years ago and 5.x is still the new kid on the block for me, with all this crazy enhancements! :-D

Though I also totally forgot things like array creation syntax and wonder how I could have ever lived without stuff like that shorthand.




Consider applying for YC's Winter 2026 batch! Applications are open till Nov 10

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

Search: