Live data from Hacker News

25 Years of PHP

jetbrains.com

291–300 of 426 posts

Re: 25 Years of PHP

#291
post #103

Earlier quoted context omitted.

> Another advantage is that php runs each request with a clean state PHP apps are almost guaranteed to be "stateless", thus scaling up and down is quasi-painless also.

OTOH, sometime you need state, then you feel stuck with a half-finished language.

If you really need a shared memory pool between requests you can use APCu.

Re: 25 Years of PHP

#292

Earlier quoted context omitted.

Um, I'm not defending mysql_real_escape_string. I'm not sure how you got that from what I wrote. I was saying use PDO. Anyway, I don't care enough about what you're going on about to spend the effort arguing with you - it seems like you just want to argue, so how about we say "you win" and move on.

I know you don't care, you've made that very clear. If you cared about truth or accuracy, you wouldn't have made an appeal to your own authority by bragging about impossibly using PHP and making database driven web sites for 39 years, or tried to excuse your moving the goalposts by claiming to "have a bad habit of not clicking on parent to see what the context of a post is". "I don't care" is Rasmus Lerdorf's attitud…

What are you getting out of this? He worked on php and look how far it came, what have you done?

Your own website was written in php which you took down due to a security vulnerability in a framework... now is it php fault that someone wrote vulnerable code?

"Temporarily offline due to Drupal security vulnerability."

Re: 25 Years of PHP

#293
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…

While I agree that PHP does have pros as well as cons, I find it disconcerting that I've read MANY assertions here on HN, that PHP detractors just haven't used it very much or are mostly complaining about things like bad standard library function names. I've used PHP in earnest. It and JavaScript are tied for worst programming languages I've used. JavaScript gets more of a "pass" from me because I'm just not a dynami…

No sir PHP is nothing like java ! PHP while not perfect gets out of your way and lets you code. Sure it's not perfect but start with one file and one tag , upload to server and you have have something.

Java: the amount of files and java-knowledge and xml files crap one has to go through... No thanks.. PHP might not be perfect ! But it's NOTHING like java.

Re: 25 Years of PHP

#294
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 agree with you. PHP did its job. For years it provided features no one had. Actually i find it funny people who didn't code in PHP criticize it. Or, even better, if JavaScript, Node.js, ASP.NET or TypeScript brag about how PHP is bad.

Re: 25 Years of PHP

#295

Earlier quoted context omitted.

The array key thing doesn't crop up often, but I've had it happen. Sometimes you are parsing something, such as "all files in this directory" and want to use the filename as the key and maybe store metadata or something as the value. Well, the second one of those filenames looks like a number, you're basically screwed. Now your array has some string keys and some int keys and operating on it is inconsistent at best.…

Yeah, alright, I understand your example now but I would argue that it's more of a problem with actually using filenames as array keys than it is a problem with PHP. Even so, wouldn't you be able to ensure that it's a string by doing `$array[(string)$filename] = ...`? (Again, I don't think using filenames for array keys—in any language—is a good idea but we're theorycrafting here.)

Oh, come on, don't try to defend a PHP design flaw by blaming people who use perfectly valid file names, and people who do perfectly valid things like using file names as array keys.

Can you actually refer me to a programming language style guide that says not to use file names as array keys, or are you just pulling that out of your ass -- I mean theorycrafting?

I've got a great idea, inspired by mysql_real_escape_string: PHP should have a real_array() function and data type that doesn't screw you when you use file names as keys! Now we just have to get all the php programmers to defensively use the "real" version of every function and data type, just in case. And also a linter that complains when you use functions without the word "real" in them.

Sarcasm aside, can we please stop blaming the victims to whitewash PHP's obvious design flaws?

Re: 25 Years of PHP

#296
post #73

Earlier quoted context omitted.

Every time there's a story about PHP there's a comment like yours, and then in reply there's a comment like mine: Yes it's perfectly fine to use PHP if it's a productive environment for you. Of course it's possible to write good software with it. Of course a skilled developer will manage to do great things with sub-standard tools. Many extremely popular websites were and even still are powered by PHP, that's undeniab…

> This revisionist stance that there was never anything really wrong with PHP This strikes me as a strawman. PHP spent years being a generally loathed language for reasons that at this point aren't really worth reiterating. But, in an analog to Javascript, it has made progress, grown up and become a better language. One of the best? Like Javascript, no. But serviceable at worst. I stopped earnest work in PHP ~ 5.7. I…

>This strikes me as a strawman. PHP spent years being a generally loathed language for reasons that at this point aren't really worth reiterating.

This story is called "25 years of PHP" and the parent starts their comment with "I wrote a lot of PHP from 1999-2008". In this context I think it's fair to remind people of the many... controversial choices the PHP developers have made (or, maybe more accurately, stumbled upon) especially early in its history.

I certainly hope that most of these earlier flaws have been addressed, and I'm willing to believe that modern PHP can be a much better language to work with but that doesn't mean that we can say that criticism wasn't ever warranted. Lest we forget this is a language that once shipped a function called "mysql_real_escape_string" and saw nothing wrong with that and a tertiary statement whose precedence works backwards from any other language with a similar construct.

Re: 25 Years of PHP

#297
If it's THAT bad.. why is it still around and under active development 25 years on ?

Sure COBAL is also still around but the amount of new projects started in COBAL vs PHP is a lot less.

Re: 25 Years of PHP

#298
post #9

Fine. After 20+ years of PHP development I'm going to give it a shot. Will be attempting to migrate from VSCode. Any tips for that transition in particular, or for setting up PHPStorm in general? I have a subscription to Laracasts and plan on watching that series, but I'm not sure if it's outdated. Thanks!

I second the PHP Inspections (EA Extented) plugin.

If you use Symfony don't miss the plugin, it's almost (dev-)life changing.

If you use xdebug take the time to set it up (way easier these days but can still be challenging depending on your setup), breakpoints work great.

More related to all Jetbrains IDEs:

One often overlooked aspect is the database integration (look at the tabs on the right). In addition to replacing most needs for a third party program it gives you autocompletion for your in-code sql querys.

Checkout the git integration. From the "annotate" entry menu to the all fantastic diff/merging/etc tools.

Lean to use the different searches, "in path" (toggle the preview option), classname, file, or the global shift-shift.

Try all the integrated tools, the terminal & ssh, the http client, the live templates, etc.

Lean about the local history (usually in the context menu above the git entry), it will save your ass at some point (it can restore entire deleted-by-mistake folders).

Re: 25 Years of PHP

#299

Earlier quoted context omitted.

While I agree that PHP does have pros as well as cons, I find it disconcerting that I've read MANY assertions here on HN, that PHP detractors just haven't used it very much or are mostly complaining about things like bad standard library function names. I've used PHP in earnest. It and JavaScript are tied for worst programming languages I've used. JavaScript gets more of a "pass" from me because I'm just not a dynami…

No sir PHP is nothing like java ! PHP while not perfect gets out of your way and lets you code. Sure it's not perfect but start with one file and one tag , upload to server and you have have something. Java: the amount of files and java-knowledge and xml files crap one has to go through... No thanks.. PHP might not be perfect ! But it's NOTHING like java.

First of all, I was talking about the language. Not the dev-ops. The language semantics are almost exactly Java.

Also, if you're talking about a single-file project, you can do that in Java, too, using plain old javac. It's not quite as simple as dropping a file on a server (but it's really damn close- first run javac, THEN plop the file on the server).

But you're fooling yourself if you think you don't have to do any setup to get a publicly facing PHP app to work. If you don't configure your Apache or Nginx or fiddle with your .htaccess junk, then you're not actually doing anything. So it's not fair to complain about "xml files crap" for Java and not discuss the equivalent for PHP, which is fiddling with php.ini and installing php_mod and configuring that in your Apache or whatever.

I am currently working on a Kotlin backend project and I haven't touched any XML. I've done plenty of Java/Kotlin and PHP.

Re: 25 Years of PHP

#300
post #6

PHP is damn fast now, no joke. And with all of the modern features it's actually not so bad to work in. I'm becoming increasingly puzzled every time I see PHP hate now, especially when I read tired comments like "just use rails". Laravel is arguably as good or even better than rails at this point, and PHP 7+ is definitely light years faster and lighter. One thing that still sucks is package management / composer.

The speed is the main reason I decided to experiment with building a Node.js module last week that allows you to use PHP as a templating engine for Express apps: https://www.npmjs.com/package/php I had guessed that PHP might be faster than mainstream JS-based templating systems like EJS and in my tests so far in an app I'm building it appears my guess was right. Even with the overhead of serializing and deserializing…

Is 10% enough to switch though ?
Post reply on HN