Live data from Hacker News

25 Years of PHP

jetbrains.com

381–390 of 426 posts

Re: 25 Years of PHP

#381

"Smarty released. The best-known templating engine for PHP. Rasmus realized that he had done something wrong when people started writing template engines for his template engine in his template engine" :D

You end doing real, production work on some codebase that uses Smarty. You grasp why. Your next PHP project uses Smarty because you learnt some good things about it. Always balance the pros and cons. Until real world work is done, almost all hate is based on judgement done in blog posts.

Re: 25 Years of PHP

#382

Earlier quoted context omitted.

Just like I tell people that buy cordless drills at Harbor Freight, "sometimes it IS the tool". Does that mean you can't build fast, meaningful, cool things with it? Of course you can. But, the deeper you get, the more problems you'll have to solve with weird esoteric knowledge. I'll agree with all of your points on horribly inconsistent and broken language features. I get that people that have grown up with the lang…

I mean, who uses mysql_real_escape_string when you have PDO and bindings ? PHP isn’t perfect. As OP said, no language is, and any competent software engineer uses the parts of the language that work well for them, and just ignores the things that don’t work for them. I don’t believe for a second that the abuse the language has suffered over the years has anything to do with mysql_real_escape_string, it’s more to do w…

> Used properly and judiciously, PHP is a powerful tool.

What is a 'powerful' programming language?

Re: 25 Years of PHP

#383
post #365

Earlier quoted context omitted.

You couldn't be more wrong about the ease of deployment. PHP is one of the hardest things to deploy. You need at least a web server and a process manager. Most popular choices are nginx + PHP-FPM or Apache + libapache2-mod-php. You also need to learn how to properly configure both of them, since both have like a million options, and default installation doesn't work in a lot of cases (e.g. uploading of files larger t…

Seconded. I was left scratching my head for a long time trying to work out why php-fpm, when reloaded via systemctl on CentOS 7, was not setting-up /var/run/php-fpm.sock with the correct ownership. I eventually had to write a shell script to resolve the issue. The version of php-fpm in question, by the way, was a more up-to-date version than the CentOS 7 default. Anyway, that's just one example of how mdoern PHP depl…

For reference, related php-fpm config directives: listen.owner, listen.group, listen.acl_users, listen.acl_groups

And probably some SELinux config as well if the installed php package doesn't have them.

Re: 25 Years of PHP

#384
post #32

I wrote a lot of PHP from 1999-2008. First as a hobby, then professionally. From 20 LOC guestbooks to payment gateways used to process millions in payments. It wasn't until recently that I was sure I'd written more code in any other language than PHP. These days I'll occasionally poke around with it or patch a bug, but that's about it. Is it a perfect language? No. But which language is? (I can hear the Lisp crowd gr…

> Is it a perfect language? No. But which language is? This has got to be one of the worst arguments (or rather, pieces of rhetoric) there is [0]. [0] - https://www.lesswrong.com/posts/dLJv2CoRCgeC2mPgj/the-fallac...

Something about perfect being the enemy of good comes to mind..

Re: 25 Years of PHP

#385
post #355
post #32

I wrote a lot of PHP from 1999-2008. First as a hobby, then professionally. From 20 LOC guestbooks to payment gateways used to process millions in payments. It wasn't until recently that I was sure I'd written more code in any other language than PHP. These days I'll occasionally poke around with it or patch a bug, but that's about it. Is it a perfect language? No. But which language is? (I can hear the Lisp crowd gr…

I also wrote a lot of code in PHP back in the day - although less than you, it sounds like. I started using PHP just before PHP 5 came around. And let me tell you - working with legacy code that used magic quotes or auto-globals is the reason I'm a die-hard strong type programmer today. On the other hand, PHP didn't get in the way. It gave you a simple way to map a URL to a piece of code, and then let you respond to…

Good grief. Magic quotes was such a terrible to work around a terrible problem. Let's try to fox SQL injection by magically messing with user input in the assumption that it will end up being appended to an SQL query Yikes. You'll be pleased to know the feature no longer exists. I haven't mourned its loss. Disabling that was a mainstay of any PHP config I touched.

Re: 25 Years of PHP

#386
post #93

Earlier quoted context omitted.

Your desktop monitor should already be in landscape mode, shouldn't it?

Not if you code a lot. It is not rare for developer to use vertical screen. https://img.devrant.com/devrant/rant/r_200135_Q9Fh4.jpg

Yeah but usually vertical screens are really easy to rotate back to landscape. Does anyone use an exclusively vertical screen? I've never come across it.

Re: 25 Years of PHP

#387

Earlier quoted context omitted.

> I mean, who uses mysql_real_escape_string when you have PDO and bindings ? You've made my point. A person with tribal knowledge probably would NOT. Any new user coming from reading an older blog post or perhaps a PHP book would have no idea that that "older approach" is out of date. Furthermore, the more precise point I was trying to make there was as a language designer, how on earth would you be okay implementing…

https://dev.mysql.com/doc/refman/8.0/en/mysql-real-escape-st... Many of the PHP extensions are direct exposure to underlying libraries. MySQL introduced a 'real escape string' in their client library, PHP exposed that directly. Had they ignored it, or renamed it, or changed param order, people would have complained about that too, no? > Any new user coming from reading an older blog post or perhaps a PHP book would h…

> Many of the PHP extensions are direct exposure to underlying libraries. MySQL introduced a 'real escape string' in their client library, PHP exposed that directly. Had they ignored it, or renamed it, or changed param order, people would have complained about that too, no?

Don't most ecosystems use some type of namespace for that instead of exposing everything as global functions? Those practices were quite late to the PHP community.

Re: 25 Years of PHP

#388
post #39

Earlier quoted context omitted.

> But neither the choice of language nor the lack of framework are to blame. This is partly true. It is possible to make something great with substandard tools. I suspect a master craftsman with a set of dull saws and blunt chisels using his shoe for a hammer will still have the skill to create something pretty good. But it will be frustrating, and most people aren't master craftsmen so what they will produce will be…

you mean your favorite language prevents you to copy paste code, have variables shorter then 4 letters and also fixes the bugs for you, let me know this cool language so I can try it. I am also sure that in your first years of coding your code had no issues similar with the ones you described.

Actually my favorite language (C#) comes with static typing, a compiler, a step by step debugger and an IDE that allows me to have long variable names at no cost and I have fewer bugs.

So yes my first year code was better than what these 2 interns did in PHP and a random text editor.

Had they used C# (or Java for that matter) the app would be much more maintainable in the short time that I can allocate to it.

Re: 25 Years of PHP

#389

[flagged]

> interns > more than 10 years ago How that looks to me: Wow, that application has provided so much business value (over a decade worth) despite being designed by less experienced software engineers. PHP must be a great language.

It's non critical and isn't core to what we do. I don't have much time to allocate to it.

My point is that all else being equal if it had been developed in Java or C# my job would be much easier.

Re: 25 Years of PHP

#390

I've written many languages (starting with ML –Machine Language). I'm currently developing in Swift, and loving it. I wrote PHP for about 20 of its 25 years. I never really got to love the language, but got fairly good with it. I don't miss it much. I have used it to write some industrial-scale systems, though. It's a perfectly good language, and is still under active development and improvement; with a vast user bas…

I enjoyed working with Swift, and I did enjoy working on Objective-C as well back when; my main gripe with Swift is that it's still a niche language for niche applications, unfortunately, and only really practical in a Mac environment.

XCode is great though, I miss working with it. I miss the browser-like swipe-to-go-back operation. I did set up a theme similar to Midnight in IntelliJ though.

Post reply on HN