The language isn’t perfect but I love working with it, these 8.1 and 8.2 improvements have really made it sweet.
My biggest gripe at the moment is the (very old) behavior of e.g. preg_match() and sort(). You’ve got a small handful of these common functions that operate on their input by reference/in place which is gross. A new version of these would be welcome.
Great! Keep using it! Ignore us. We (detractors) also had to use it and have since learned (hopefully several) other languages that (not looking at you JS) we like much better... :)
If it's recognition for learning <insert-language>, how do I provide it to you?
If you've long moved on and are no longer using PHP, why do you still consider yourself a "detractor"?
>sleep(int $seconds)
>returns zero on success.
>If the call was interrupted by a signal, sleep() returns a non-zero value. On Windows, this value will always be 192. On other platforms, the return value will be the number of seconds left to sleep.
I've used it for 2 years 2 years ago and I'm not at all interested in starting a project with it again
I still occasionally work with PHP for WordPress and it is still mostly not great. The mess of abstractions, the JS-like library installation system, the lack of any kind of concurrency, the mess with errors vs exceptions.
It just isn’t a language that makes me happy. Then again, I dread opening a .php file so maybe it’s a preconceived notion.
PHP just happens to be good at getting stuff done fast, so it's found all over the place, and thus has a lot of eyeballs on it. The negativity is a byproduct of it's usefulness and staying power - the price of popularity, if you will.
I love PHP, especially with the new event loop based modules that let you do things asynchronously, much like Node or Go.
If you know how to use it well, PHP is awesome, and it's getting better with each release.
PHP opened the door to cheap web dynamic web hosting and in turn you had self-hosted applications like Wordpress. It was a few years later that languages like Java and C# became really attractive for back end work, you also had Ruby, Node, etc.
I wrote a lot of PHP in the early 2000s because that is were the work was, that’s what you could write open source code that people would use in, and it was really straightforward to build apps (like a social network for a secret society) without an ‘ops’ team watching your every move.
Yes it's a userland workaround and not a fix for the language, but it's thinking about these issues and a PHP extension (offering better performance) is being talked about.
PHP is nothing if not amazingly well documented. This is more than I can say for a lot of languages I have worked in cough Ruby cough. I work pretty heavily in Go these days and even it’s docs leave me wanting in comparison sometimes.
Do you mean how you can have an optional out parameter to get more detail than what the return parameter gives for which group matched?
Personally i dont see anything wrong with that, but to each their own.
Libraries are infinitely preferable to frameworks if you want your application's life cycle to be independent of $POPULAR_FRAMEWORK's.
Even with Laravel, which is the current thing in the PHP world, I've worked in multiple teams where their application is written in a very old version of Laravel and there's no desire to attempt an upgrade to the most recent version.
The no-brainers to me are the missing array_some()/array_any() array_every()/array_all() and an array_search() that takes a predicate and iterable. I do these now in userland but an optimized native version would be nice.
For better or worse, there's some degree of 'upkeep' that has to be done with any code, if only to take advantage of some newer tooling (even ignoring security and performance concerns).
> and there's no desire to attempt an upgrade to the most recent version
That seems to be a problem there. I would not want to be using, say, Laravel 4 in 2022. Nor early Symfony, or any other framework (or library) that is years out of date.
What's been interesting to watch in Symfony and Laravel is to see an ecosystem grow around them which amplifies the value of using that framework (laravel shift springs to mind, based on your example above).
The danger seems to be in being complacent, regardless of tool choice. I've had to go back to Java/Spring code I wrote 10 years ago, and it's... challenging to make some things run again.
The projects I start today got the php replaced by typescript
Non-java devs think of java as Java 6 when in reality it has pretty significantly evolved in the last decade. I dare say that it's one of the most rapidly evolving mainstream languages on the market at this point.
Php is in a very similar situation, the difference is you can't escape javascript so we all to some extent keep up with its developments. People who leave php left it at a certain point and their understanding of its issues is frozen there. It's very predictable and boring honestly.
What does that lib do that PHP doesn't?
Does it deterministically pass ALL tests in its own test suite yet? 100% of the time? This was the state just a few years ago, where a lot of tests were simply disabled because they were "flagging". <insert eyeroll emoji> (I'm not even going to touch the Boolean chart showing the different behaviors of single, double, and triple-equals on results. I know a lot of that has been fixed, at least by "convention".)
Nondeterminism is literally the worst trait of a computer language, because it leads to the worst kinds of bugs- the ones that are NOT a result of your lack of understanding of how the code is supposed to work at the PHP level. I've literally burned months away in my career in tracking down bugs like this (in Ruby and other languages), which ended up being framework or language bugs. There comes a point when you say "never again". Unfortunately, it comes too late in most people's careers to realize they've made a mistake, and switching to another language/community becomes too expensive/risky a proposition for them. (In my case I've been fortunate in that I was able to switch from .NET, to Ruby, to Elixir... each one of these was a difficult transition, both intellectually and socially (I really miss the Ruby community!), but in the end, completely justified in my case.)
I've only done PHP for small personal projects and some wordpress hacking, and that was years - so my experience is limited. But it seems to me that one of the great and tragic things to PHP is the low barrier to entry. As you put it: "first open source language in which just anybody could write server-side web applications without terrible management problems for the sysadmin".
This made it extremely easy for anyone in the early 2000s who signed up for a web hosting account on godaddy/hostmonster/hostgater/etc... to fire up a text editor of their choice and start slinging code and FTP'ing up to a server. Didn't have to worry about installing, configuring, all the dependencies, build tools, etc... just edit, upload, refresh -- lather, rinse, repeat until it works. Lowered the barrier to entry, and got a lot of people into the field. Really powerful stuff.
It also made sloppy, hacked-together, copy-pasta code very prevalent. In my limited perspective, I suspect that this prevalence of sloppy spaghetti-code has contributed to PHP's bad reputation. It's not that you can't do good code (totally can!), but a PHP environment can be forgiving of some pretty bad practices.
I don't like arguments like these because they're a tu quoque without even bothering to point out flaws in a different thing. It implicitly states that progress is impossible, that all languages will always be as bad, and nothing can ever improve because once a technology is widely-used, design flaws will magically appear. If you really believe that, write your next website backend in FORTRAN IV.
It was lazy argumentation when it was people saying Linux was just as buggy as Windows Me and it's lazy argumentation now.
PHP has a low barrier to entry, but that's a great thing in my opinion. It's something that should be celebrated, and at the very least, it shouldn't be a criticism!
Bad developers exist in every language, and no language is completely wart-free. People just like to zero in on PHP to criticise it because it's easy, and it bugs me a bit (especially if they're simultaneously singing the praises of another less than perfect language such as JS or Python or Go).
At that time you could have made similar software for JSP, ColdFusion or ASP.NET but hosting would have been much more expensive and a big hassle. With PHP it was feasible to offer a $5 a month hosting plan good enough for blogs and simple web application.
I wrote a lot of PHP because it was a great way to deliver products to customers, particularly ones that didn't have a lot of resources for "ops" but also a place where I could write open source software which might really get used and have an impact.
I don't recall the sequence of events that way. That is, there was regular cgi, then mod_php with problems similar to mod_perl...then later fastcgi options existed for both.
What's the newer fastcgi php method that isn't mod_php?
FastCGI is a protocol that allows a web server to communicate with external programs that provide dynamic content, such as PHP scripts. In FastCGI, the web server launches an external program, called a FastCGI process manager, which is responsible for starting and managing a pool of long-running PHP processes. When a request for a PHP script comes in, the FastCGI process manager assigns one of these processes to handle the request, and the process generates the dynamic content and sends it back to the web server.
mod_php, on the other hand, is an Apache module that embeds the PHP interpreter directly into the Apache web server. This means that PHP scripts are executed directly within the Apache process, without the need for an external process manager.
While both FastCGI and mod_php are ways of running PHP on a web server, they differ in their implementation and how they handle requests for PHP scripts.
The Java 8->11 transition was rough but honestly after that we've not really experienced a whole lot of pain. 16 has been a little bit of a pain as well since it closed some more unsafe holes. I think that's the last release, however, that's going to cause major headaches with migrations.
As for the second part, I understand why system calls are interruptible, particularly before the implementation of many syscall-level asynchronous operations. However, too many languages require too much boilerplate in the much, much more common case where the developer wants the appearance of an uninterruptable system call in a multi-threaded and/or multi-actor program.
I've written plenty of interruption-safe sleep and I/O code in C. It's disappointing that same C boilerplate needs to be used in PHP, Java, etc. If you want to expose the interruptiblity of a C sleep(), call it interruptible_sleep(), and make sleep() a wrapper that contains the boilerplate you want 99% of the time in C. I dare say 90+% of programmers don't properly deal with interrupted sleep system calls, and exposing the interruptions should be opt-in.
In retrospect, at the syscall level, the C library interface to interruptible syscalls should take a function pointer to an interruption handler that returns a boolean as to whether the syscall should be transparently resumed. Passing a null handler should result in the syscall appearing uninterruptable to the calling code. Most programmers are blissfully ignorant of interrupted syscalls and are perplexed by seemingly random resultant bugs. The default interface to these calls should protect the programmer.
// sleep(int sec) should look more like:
void sleep(int sec) {
sleep_interruptible(null, sec);
}
void sleep_interruptible(bool (*handler)(int), int sec) {
struct timespec ts = {sec, 0};
int prev_errno = errno;
errno = EOK;
while (nanosleep(&ts, &ts) != 0 && errno == EINTR) {
if (handler != null && ! handler(errno))
break;
}
errno = prev_errno;
}We’re always looking btw.
Deploying to the cgi-bin directory was more convoluted and error prone for end users. Even when you did it right all of your URLs had an "ugly" cgi-bin component.
The easy deployment and cheap shared hosting with their managed MySQL instances really helped boost PHP's usage.
Have you consider that people who learn other programming languages are not doing so in order to claim that they're better than PHP programmers, but for their own intrinsic reasons?
It's such a weird, fragile ego situation. Does everyone else have to pretend that PHP is the only language that exists in order to placate your sense of inferiority?
I'm speculating though.
I get where you're coming from, I think the way I'd think about it would be a little different. The interruptible part is semi-specific to sleep. I'd want predicable naming for syscalls first and foremost. So something like libc_sleep(). (libc_open(), etc would follow too) This makes is more obvious you're dealing with a pretty raw api. But otherwise agree. I haven't written any PHP in nearly 20 years, so I completely forget: is sleep() pretty typical of how PHP treats these syscalls?
> Progress is impossible
Huh? My very last sentence implies quite the opposite.
Java has been slowly adding the best kotlin features (such as data classes, records) which also makes it a bit harder to sell.
That said, I've introduced kotlin on a few teams and pretty much everyone that's worked with it has complimented it.
Isn't it better to tie projects to specific libraries rather than frameworks because it should be easier to swap/replace a library than the whole framework ?
(Or is that OOP kool-aid I still taste ?)
> Write an explanation for the user who posted the following comment: "Wait. Isn't fastcgi essentially the same as mod_php? IPC with a long-running process rather than forking and capturing stdout? What's the newer fastcgi php method that isn't mod_php?"
is:
> FastCGI and mod_php are similar in that they both use a long-running process to handle PHP requests, rather than creating a new process for each request. However, they differ in how they are implemented and how they interact with the web server.
FastCGI is a protocol that allows a web server to communicate with external programs, such as PHP, to handle dynamic content. It is typically used with web servers such as Apache or Nginx. In the case of PHP, the web server uses FastCGI to send PHP requests to a PHP-FPM (FastCGI Process Manager) process, which then executes the PHP code and returns the result to the web server. This allows the web server to handle multiple PHP requests simultaneously, improving performance.
On the other hand, mod_php is an Apache module that embeds the PHP interpreter directly into the Apache web server. This means that Apache can handle PHP requests itself, without the need for external programs or FastCGI.
Whether or not you should be doing that is another matter… but it’s useful in some cases and easier to grok than using reflection or using array syntax on an object (like JavaScript).
After awhile, you don’t even notice the $ to be honest.
In fact php with composer and tooling is really good these days. Most people I've met (in person) who hate on php can't say why. They tend to equate php with wordpress.
I've picked up their projects and see many problems but I don't go blame the language they chose.
PHP has made huge strides in progress over the last decade.
Your reaction: "why do PHP devs get upset when ex-PHP users write false things about the language? Also, none of you know any other languages".
Thanks for the ad-hominem, that concludes this discussion.
Also, plenty of people who use PHP know so many other languages. You don't appear to be a professional in this industry, especially not with this kind of discourse.
Take care.
My comment was in response to you asking whether the other user (who as far as I can tell was not posting any false information about PHP, just pointing out that they personally preferred other languages?) wanted _recognition_, from you personally, for having learned some other language.
This is such a weird reaction to have to the idea that someone has learned, and/or would rather use, some other language. I hope you can see that.
Of course, it's not just you. I have never seen any programming language community that feels _threatened_ by the idea of other languages existing and being learned, in the way that the PHP community does.
Fundamentally, this is a learned social behaviour, which means that whether or not individual PHP developers know other languages does not matter. A community that treats acquiring additional knowledge as a _threat_, seeing learning from the outside world as a _betrayal_, will not be able to learn _from_ other languages.
As bringing new ideas and thoughts into the community is socially discouraged, it will only be possible for learning to flow in one direction: away from the PHP community.
I asked what prompted the person to type that kind of reply. Had you read the entire topic, you'd see plenty of false info being posted, but my point remains: you used PHP, you moved on, what prompts you to be active in topic about PHP where all you contribute with is "I moved on."
> This is such a weird reaction to have to the idea that someone has learned, and/or would rather use, some other language. I hope you can see that.
And we're in territory of mental gymnastics now :)
You think the reaction is to learning another language? You're obviously a programmer. Can you tell me how many possible outcomes exist and how come you chose this one in particular?
Reaction was not to learning another language, it's ridiculous.
> I have never seen any programming language community that feels _threatened_
You never read linux mailing list and c vs c++? I can't take you seriously, you talk as if there exists de-facto "community". There isn't one, it's just a bunch of people who use various forums and there's no coherent community. You interacted with several people and you label that community and then you purposely shove words that haven't been written only to challenge them.
It's a straw man argument.
You persist in labeling PHP devs so narrow-minded that they chase away people who learn other languages. I don't know which (human) language I need to use, but it's apparent that this is becoming multiplayer monologue. I write one thing, you claim I wrote something else and then you generalize based on it.
Notice: I haven't tried to provide my "credentials" by listing what languages I know or what I do. I never even stated I'm a PHP dev.
You, on the other hand, labeled me and entire PHP community as weak-ego, tribalists who frown upon other languages and that the PHP community, which apparently you researched somehow, is different to all other communities - which you also apparently researched. In this whole wall of text you wrote, you have't asked a single question. You merely stated something and then you proceeded to take up the higher moral ground and then demean people. Do you think such discourse is productive?
> Fundamentally, this is a learned social behaviour, which means that whether or not individual PHP developers know other languages does not matter. A community that treats acquiring additional knowledge as a _threat_, seeing learning from the outside world as a _betrayal_, will not be able to learn _from_ other languages.
In this very topic, I wrote about features I'd like to see in PHP - one being generics. Something I learned in C# and something that changed my entire stance to JS because of having used in TypeScript.
That's just _one_ example of how you assume without zero facts to go by. I won't bother listing what we do for feature suggestions in PHP, which languages have great features and what we do to bring them in. You're just incapable of reading and you merely recognized me as a "bad guy" because I called someone out. I seriously doubt you'll read this, it would take more than 13 seconds of attention and that's something hard to acquire these days.
TL;DR: nice gaslighting and straw man, thanks for ad-hominem, I wish you well in the new year :)
> Had you read the entire topic, you'd see plenty of false info being posted
I've honestly looked through all of the original poster's comments and couldn't find any misinformation. Except for referencing r/lolphp, which is indeed mostly wrong about everything.
> You think the reaction is to learning another language? [...] Can you tell me how many possible outcomes exist and how come you chose this one in particular?
I thought so, although I see now that I was wrong. I still don't understand what else your response, saying "Do you want recognition for learning other languages?" to a comment saying "I no longer use PHP and I have learned other languages that I actually like", was supposed to be reacting to, but I take it that there are other possible interpretations that I'm not grasping here.
> you talk as if there exists de-facto "community". [...] it's just a bunch of people who use various forums and there's no coherent community
Obviously a community as big as the PHP community is always going to be, in turn, fragmented into smaller communities. Symfony is not Laravel is not WordPress. But that doesn't mean that you can't draw generalisations from it, like how you would say "the Python community is scared of big breaking changes". This doesn't mean that every single member of that community is personally scared of big breaking changes. It's a generalisation about the behaviour of a group that doesn't extend into a judgement of each and every one of its members.
> You, on the other hand, labeled me and entire PHP community [...] which apparently you researched somehow
I thought there was no such thing as a PHP community. I described a general vibe that I perceive from a given community, which I have extensively interacted with and been a part of. Unless it doesn't exist, in which case I suppose I haven't.
I then compare it to other communities, which I have also interacted with and been a part of, if they indeed exist. My perception nonetheless may be flawed, and it does not need to apply to you specifically.
> I wrote about features I'd like to see in PHP
It's great that what I said above does not apply to you. Your personal appreciation of other programming languages' features, in turn, does not change what I perceive as the broader community's culturally enforced commitment to willful ignorance.
If I'm going to guess is that you have interacted with non-professional and/or beginner level PHP programmers, they could feel threatened becuase the only development skill they have is rudimentary PHP and you are asking them to replace that with something much more difficult. I have seen some of it myself, and it has always come down to lack of skill.
And this makes sense why you have encountered this within the larger PHP community, becuase PHP is an easy to learn beginner friendly language that is used by the majority of blog and forum systems, zero setup web frameworks, and all of it can be set into production on almost every server on earth. Thus there are many low skilled PHP developers, probably more than moth other languages.
And this is the lessons, it is important to understand that every community consist of large variety of disparate groups, especially within the PHP community, and it is up to you to learn to distinguish them. Unfortunately many are blind to this when it comes to the PHP community, outsiders may think the work I do professionally is the same as someone setting up blog for the first time, just because we use the same language. It would be same to think that the result of a first grader learning to write is the same thing as Tolkien's writings becuase both are in English.
Care to explain what you mean it's broken if disabled? That it is disabled (noop in runtime) so you're missing it? AFAIK that's the production setting. You should be able to enable it in build/test/ci/development, just how you want it.
How we train our dev's is to use those courses and to have our current PHP/Sugar dev mentor them on the differences.
Or even which of those companies even hire PHP devs anymore?
But that might just be me and/or my particular use case.