Earlier quoted context omitted.
> Each request is pretty much independent of the others, and each one can independently crash. Not the case anymore with phpfpm.
php-fpm uses a worker pool. How is this true unless you corrupt the shared memory segment?
25 Years of PHP
391–400 of 426 posts
Re: 25 Years of PHP
#392> PHP to have str_contains() A function that checks if a string is contained in another string? That should only take about 25 years. For anyone else confused by the newest thing on the list who is wondering what the heck str_contains() does that you could not already easily do with strstr() or strpos() since time immemorial, the answer is nothing. The only difference between str_contains($needle, $haystack) and strs…
Of course, it also highlights one of PHP's often repeated criticisms, that of function naming inconsistency.
Re: 25 Years of PHP
#393Earlier quoted context omitted.
I dont agree with you at all. Why are you building arrays with mixed key types? Why do you want type hints? Why do you need generics in a dynamically typed language? Php has pthreads. They just arent needed that often. Async is being worked on You didnt mention it but immutable types are also being worked on. Everything people complain about php over tends to actually make its way into the language eventually. I dont…
I am reminded of 2 things while reading your comment: 1. The meme where someone sits in a burning house or room and says "It's fine.". 2. "Sweet lemons". That is the sort of psychological "strategy" that is often applied and that seems to be used here: Things are bad, so lets talk them good. It all sounds like "Oh come on, it's not so bad!", but that is not the point. The point is, that compared with more developed l…
As a Clojure developer, I see plenty of things that might be better in PHP in language design (making existing syntax more powerful instead of adding more syntax), implementation (make sure there are no memory leaks for example), stdlib (make one big incompatible release and make sure all functions have consistent naming & parameters & return values).
But today, in the age of PHP 7, frameworks and thousands of libraries, short requests that make memleaks insignificant, I think PHP is an awesome productive language. A language purist who loves elegance (like me) would not take a fancy of PHP, but the same goes for Go, C, C++, Lua and in some way also Vala, D. These languages are just highly practical hammers. Nothing to love, nothing to play with. But boy, these hammers are highly productive and in the right hands and appropriate situation, they are very hard to outcompete.
For some people, using PHP can be the best solution (Do you know C-like languages? Are libs you need in composer? For such a person PHP might be a way to get the result fast).
Re: 25 Years of PHP
#394Earlier quoted context omitted.
I strongly agree Smarty is beyond terrible (and I've used it and read the source code, so I know its problems first hand) and the fact that it even exists is indicitive of deep flaws in PHP, but I don't believe Rasmus has ever realized that he did anything wrong. He just doesn't care. "We have things like protected properties. We have abstract methods. We have all this stuff that your computer science teacher told yo…
Why is the use of Blade(Laravel) or Twig(Symfony) any more acceptable than Smarty?
EDIT: I certainly prefer using Blade to doing the old '... and other similar variants.
Re: 25 Years of PHP
#395Earlier quoted context omitted.
Movable Type was popular, but a change in its licensing terms led to people leaving it in droves for Wordpress which had a similar interface and approach. Fast forward to 2020, and Wordpress installations reportedly make up the majority of PHP use in the world.
If I'm reading that correctly, the license change happened in 2013... Well after Wordpress was already highly established as the dominant player.
Re: 25 Years of PHP
#396Earlier quoted context omitted.
Ah yes, the classic "my application is shit so the language must be shit" straw man argument. Sorry to hear you have to work on shitty code. But neither the choice of language nor the lack of framework are to blame. Blame the developers and/or the organizational culture that caused it to be in such a poor state.
> 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…
There are hundreds maybe thousands of languages. And when you measure all things (expressiveness, stdlib, productivity, ability to build a team, etc.) PHP would come up in TOP10 for any webapp.
Of course, it has its gotchas. So does Clojure, Ruby, Python, C#, etc. Honestly, once a person knows PHP very well, switching a language has almost no impact besides their "feeling".
I have switched from PHP to Clojure 8 years ago. I feel better. But I am not significantly more productive. The brevity of code is higher, abstractions easier to do, overall it just feels better. But it's not a silver bullet. At the end, when a huge amount of webapps are mainly working with a database, validation, putting data to templates, and all the auth staff. All this is usually well developed in existing frameworks and libs without any extra overhead. There's not a lot of space for elegant abstractions in average webapp.
Re: 25 Years of PHP
#397Earlier quoted context omitted.
> 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
#398Earlier quoted context omitted.
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
#399Earlier quoted context omitted.
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_st…
That seems really uncharitable, he's just trying to better understand the issue and reason about why it may not have been an issue for him. Can we not all agree that if there are objective flaws in PHP, speaking about it objectively might be the simplest way to communicate it? I feel like you're quite emotionally charged, which isn't always a bad thing but I could imagine it being quite discouraging for other people to deal with.
Re: 25 Years of PHP
#400Earlier quoted context omitted.
I dont agree with you at all. Why are you building arrays with mixed key types? Why do you want type hints? Why do you need generics in a dynamically typed language? Php has pthreads. They just arent needed that often. Async is being worked on You didnt mention it but immutable types are also being worked on. Everything people complain about php over tends to actually make its way into the language eventually. I dont…
> Why are you building arrays with mixed key types? It happens on accident. All keys are converted to ints if they can be. So if you read a file that is called "123", it'll suddenly become an int key whereas all the rest will be strings. That's absolutely insane. > Why do you want type hints? The same reason anybody does. It is a contract and it makes your code more well-documented, more robust, and more correct. The…
Re; the mixed int/string key issue with filenames being the key - what issue did you witness having a mixed combo of types for the key cause?
Or was it just that the types were mixed and this was unnecessarily confusing?
Thanks