Because it’s currently 77% of the internet right now
Despite the frequent jests directed at PHP, which seem to outnumber even the plethora of ca...
For further actions, you may consider blocking this person and/or reporting abuse
My thought is that these people don't even know PHP or a very old version like PHP 5.
Improvements made to the language the last years (already started with version 7) conducts to a better language... but, unfortunatelyv(or not in fact), everyone can start coding in php. Our code can be clean or... Old syntax, most of time, will continue to work and yeah, can be better.
If you code with tools like phan, phpstan, Rector, psalm,... You can force (yourself) to have a clean code while the language by itself is more permissive.
So, yes, PHP is a very good language.
Yes, I think PHP 8.4 would be much better.
Not relevant as most php being maintained is Legacy.
Are you omniscient enough to make such a claim?
Well PHP 7.4 support has ended in 2022, so I wouldn't call legacy code still running on 7.x "being maintained".
But yes, there's a considerable amount of old unmaintained PHP code that is hurting the image of the language, just like there's still a whole lot of websites using jQuery to inject random html into the DOM, it doesn't make modern Typescript a terrible language.
edit : Juste realized I replied to a months old thread, not sure how it ended on my Dev frontpage.
PHP has ugly syntax.
C#
PHP
Not even sure if this is serious, "Ugly" is completely subjective. If you wanted you could argue that the C# example you have no way to know if name and family are constants or variables (whereas the $ makes it explicit in PHP) and that it makes no sense to "add" strings.
Even as a PHP developer I do think that C# is overall a better language, but "the syntax is ugly" is not really a valid argument in my book.
$nameAndFamily = "$name $family"; The issue of syntax is totally subjective
I'm Sorry, I was not born and did not live in an English-speaking country. I couldn't think of a word except bad or ugly and I chose ugly.
Yet you can easily construct full sentences with punctuations and correct spellings.
It is possible, indeed straightforward, to construct a full sentence with correct punctuation and spelling in a secondary language despite having limited vocabulary.
You ask for reasons... You didn't call for objektiv or subjektiv ones.
@elanatframework said it's ugly so it is for him or her.
I don't like the syntax ether.
As a PHP developer I find that C# example ambiguous. Are you concatenating or adding? If name = 1 and family = 2, would the result be 3?
C# is strongly typed. When you declare a variable, you either explicitly or implicitly declare the type of value it can hold. Whether you're adding or concatenating depends on the types of the declared variables, not what their values happen to be.
He probably meant firstName + familyName variables or similarly name ones. which is my thinking because a lot of non native english speakers use "family name" while we predominately use "last name". But i could be wrong in my logic. Its just my first thought. Also he used the string type so we've have to give him a little credit, but yes i agree his example could of been more thought out and shown a better example.
Isn't it funny to even say this, whiles there are languages like rust and go with not so pretty syntaxes, your example is not convincing enough. I think I am stucked with JavaScript and PHP because of their easy and flexible syntax.
i think languages like the c family/java have incredibly complicated syntax...i don't think it is needed to be that complex for every language depending on purpose...a string, bool, int, etc. can be easily handled by most programming languages through abstraction. if its needed to cast data types, or only allow certain types for whatever reason, i believe every language i program in has a solution for including php.
yeah... is not a type hinting language... but who cares, if you have linters?
I don't find it ugly at all. I am basically a python dev who religiously follow PEP-8. Some people can't appreciate the diversity of programming languages (like people of a certain religion). 🙁
PHP has improved a lot over the years. Version 8 is much better than version 5 for example. I think the bad connotations with PHP come from it being many developers' first language which leads to bad code.
Waiting for 8.4
It seems that.one big contributing factor to the widespread "use" of PHP is WordPress. While it shows as being used according to the stats, I imagine there is less active development and more just running established apps like WorsPress on top of PHP, which drives up the numbers.
No, they are referencing to w3techs. And in their technologies overview it explained how that count WordPress like services
IMHO WORDPRESS AND CMS IN GENERAL ARE THE BILE OF THE PROGRAMMING COMMUNITY. But i like traditional PHP, But i think a lot of times i think some things are lost when someone picks up a framework and codes without understanding the language their using...almost brings me back to WYSIWG editor days where the code was horrible to update, or refactor.
This is why the industry should stop supporting Wordpress altogether. I advocate for JAMStack development. We need to go back to using custom front ends with admin panels that limit the website owner to only focus on content.
On that we both agree on
In my honest opinion, I've started my career as professional programmer using PHP. I even utilize PHP as daily scripts over my old machines to do such automated task like scanning file systems. Nowadays I may prefer to another programming languages (preferably a strong-typed language) for my professional tech stacks but that doesn't mean I left PHP dusted. Don't get me wrong but in my country a PHP programmer is still the one searched the most because it is easy to learn (and probably the most affordable solution for several companies). One of my reason to left PHP from professional tech stacks is due to its confusing type-juggling. It is okay if you do type-juggling with primitive data types like numeric or string, but things could got worse once you starts to introduces the "class" concepts (OOP). At the beginning, PHP does not intended to be used in OOP paradigm, but they tried to evolve to overcome the new challenges at that time. It is a hard days for me to try figuring out what class type one object is, what properties available, or even what methods I could call especially with a packages with less-to-no proper documentations available. Moreover, some companies doesn't care to help the devs working on the project as long as you can still do it using sticks and stones (or at that time, Notepad++). That leaves me blind for the time being without knowing proper IDEs that could help devs properly debug the codes. It leaves some nightmare even for today. Compared to nowadays, there are many programming languages that having its own pros compared to PHP. I finally shut the book of PHP and leave it into my archive for me to read on my summer break. When I heard that PHP now supports strong-type variable, I felt so amazed that they are still willing to evolve. But sadly that doesn't mean I could joining the pool again: newcomers could learn new things even faster but for older devs (especially those who already witnessing the hardest time) it'll be a harder. "You can't throw away the past, some will still exists even if you tried to forget the past and starts anew", that's what I learned.
Again, this is merely my opinion based on my experiences. You guys may have your own ups and downs with PHP. It's okay to learn again the PHP or giving another programming languages as your favorites replacing PHP. But just remember one's talk: "Thou hast thine own inclinations, and I have mine".
Happy coding everyone!
PHP is terrible and I love it.
in_array(mixed $needle, array $haystack, bool $strict = false)
strpos(string $haystack, string $needle, int $offset = 0)
call_user_func(array($obj, 'myCallbackMethod'));
PHP now has the first class callable syntax.
And you can use strict typing to consistently return floats from your function.
Nice tip about callables, I didn't know about that!
I also didn't know about PHP's "strict" typing mode — handy tip, but still not a very satisfactory solution IMO:
If we keep
strict_types
commented out, we get this:However, if we uncomment it, we get this:
That's a strictly worse result —
return_any
remains as unreliable as before, whilereturn_int
is now unnecessarily throwing runtime errors.return_any() has barely changed; you do not force a return type hence it behaves as before.
return_int() - this is tricky as PHP decided to maintain the BC - and the divisions may return ints. Normally I'd say that when you enable strict typing, this should raise a compile time error, as you must declare the return type as float or cast to int; but there is no compiler... On the other hand, there are plenty of tools to analyze the code and warn you like a compiler would.
All in all, we find this tremendously useful. I'd say a runtime error which is logged and analyzed - is much better than silent type conversions with radom side effects. Most notably, the "nullability" (optionals) is now controlled. And, strictly typed code (in our case) runs 3x times faster in PHP8.1 than in PHP7.4.
I encourage everyone using W3Techs statistics to actually read their technological overview and disclaimer. Many people citing the 77% statistic often suggest that this figure represents the number of websites powered by PHP web applications and sites. However, this is not entirely accurate. The 77% figure indicates that PHP traces were found on 77% of all checked domains. This means that even if a domain uses PHP for only 10% of its functionality and another technology for 90%, it will still be included in both PHP and non-PHP language statistics.
Additionally, the statistics do not differentiate between the scale or complexity of the code base. For example, a simple landing page using PHP and a complex banking application built in Java are reflected with the same weight, which can be misleading. As someone who works primarily with PHP, I don't think it's a bad language—like any tool, it has its purpose. However, the claim that PHP powers over 70% of the web is often misinterpreted, and it's important to understand the context behind these numbers.
This is same for other techs too,
How does that contradict my comment? If statistics for other languages fall under the same umbrella, it doesn't necessarily make the statistical proportions correct. All I wanted to point out is that you can't use those stats without knowing what they represent. There is no verifiable statistic that accurately reflects the weight each programming language has in powering the web. You can't just assume that because several technologies were used in one system, they all have the same weight.
Its still the most reliable out of everything. Point is if there are PHP jobs in your area just learn it.
You can't rely on data that doesn't represent what you're trying to demonstrate, such as the fact that around 70% of the web is powered by PHP.
As a simple example, one programmer creates nine one-page landing page apps in PHP, and nine programmers create 9-page banking application app in Java. I am using 'one page' here as an example of a unit of measurement for coding work volume. The statistics may reflect that 90% of the web is powered by PHP and only 10% by Java. This might suggest a high demand for PHP, but in reality, there may be a greater need for Java developers. Incorrectly reading the data could lead to the wrong conclusion.
If your point is about jobs, then I'm sorry to say that the demand for PHP developers is only about 10%, if we're being optimistic, and the salary is usually lower due to the lower entry level of applicants compared to other languages.
Who said demand of PHP developers is about 10% maybe for some countries its true. The low paying jobs are by Companies who in first place would never have such a big revenue. There are big Companies using PHP too lIke Fizer,Apple who use PHP. So w3 tech stats are false and you providing PHP has 10% stats is true.
Not 10 page landing page PHP is used in making big applications after PHP 8 its a way better language.
For static pages there are whay better tools like page buidlers
Anyways you hate PHP thats fine but dont jump to conclusions without knowing. If PHP has 10% jobs show me sources my are has a lot of jobs for PHP in my area.
If learning a language gave you a 6 figure job everyone would just learn C++ and Rust. There are lots of developers I knew who learned PHP worked professionally and later they switched to other tacks. My area has most jobs in PHP and C# most developers just learn frameworks and Laravel. They dont know about Nitty gritty of OOP,Sql etc. If someone learns a language well and has good knowledge about database i dont think nowadays with resources and LLMs its really tough to learn a technology if you have strong fundamentals.
There are people bragging about Javascript where if you read some books understand the weird parts is Javascript is not a very tough language.
There is a difference between a coder/engineer. Anyways best of luck shipping Mvps in JAVA and claiming w3 techs is fake where your 10% is right.
Please learn to read properly and do not put words in other people's mouths.
I still think PHP is bad. It has improved, but the weird standard functions aren't going away, updating code between versions has a relatively high cost, and SemVer is not followed. Type hinting is an interesting feature, but type specifiers seem to create runtime errors, so you're actually like to create bugs not reduce them if you use it. The type system also doesn't seem complete (or nearly complete) like it's competitors.
Ultimately people should probably be steering away from PHP, and articles that suggested otherwise are likely a disservice to the community.
Type specifiers that "seem" to create runtime errors are revealing how carelessly you are treating values in your variables. So, you have a function somewhere which you type hinted to accept a float argument, because it is what it actually wants, but keep passing it strings. Because before you were happy that a non numeric string would be treated as zero. Potentially you ha d a lot of bugs and the strict typing helps you discover them. Of course, if there was a proper compiler that immediately would throw an error, that would be much better.
Also what do you mean by incomplete type system?
Finally, just blaming a language for features you do not (fully) understand is simply not professional.
The real world scenario is that I maintain an old project, that I didn't build. It was built that way it was built. The system is heavily used and so its proven to work well empirically, not through a great type system.
As a maintainer, it's not my role to heavily rebuild or refactor the system, nor would we really want to do this on a system that generally works well. With TS we could add types, see the errors at devtime to improve our work, and without any danger of breaking anything as types are erased. With PHP type hints, it's just not feasible to use them, as the risk far exceeds the reward, unless we are building an entirely new module. For new work it may be better, if you can ensure that types are strictly adhered to throughout the application. Yes, a dev time type checker would be helpful as you say.
As far as incomplete type system, I'm assuming that the type system in PHP isn't as powerful as something like TypeScript/Scala/Haskell. From what I can see PHP has primitives, class types and type unions (which is great). But I don't see generic functions, generic types, closure types. Type systems can be quite complex in and of themselves, and it takes a fair amount of work to have a very good and thorough type system. Given how this is new to PHP, and, let's say, not a core element to the PHP language, I wouldn't expect PHP types to be as sophisticated as other options.
I just don't see a lot of reasons to use PHP. It's not as fast as compiled languages that can be used on the server. The type system is not as advanced as others. And in the world of dynamic languages JS has a big advantage which is commonality between frontend and backend. This lets developers build full stack apps with frameworks like React, which all logic is unified into one piece of work with a single language, with the option of the probably superior TypeScript for type safe. JS on the server took away PHP's niche which was a simple, dynamic beginner friendly language to make server backends. It has a few perks, it's good for templating (HTML with a little dynamic content), and it's execution model of a new thread for each request is conceptually simple - global state is much simpler in PHP than in a Node.js app. But there's no compelling reason for me to return to using it unless I have to.
Of course, the "same language" argument is strong enough, just the philosophy of a frontend and a backend applications differs so dramatically.
The speed argument does not apply to TS - it is compiled down to JS and then interpreted. PHP8 is extremely fast and I believe it outperforms JS and Python (however it is hard to create a sensible general benchmark).
Generics - yes, that is smth that is not on the roadmap. A "typed array" would be a great start, but this can be very easily implemented by a library (but only just this).
Yeah I'm not saying TS is faster than PHP.
I'm saying that if you don't mind different languages between the frontend and backend, then PHP is competing with every language, and in the performance sensitive use case PHP doesn't win. In the performance insensitive use case, JS has similar performance with the benefit of commonality.
JS and PHP have very different performance profiles
PHP needs a new worker for each request, which I would expect to lead to higher memory usage under load. Multiple PHP apps can use workers from the same Apache worker pool if using that setup. However for security or deployment reasons it may be preferable to separate applications. On a server I have a set of apps each in their own docker container with their own Apache instance, for security isolation. Then there is PHP-fpm which I don't have experience with. The Apache-PHP approach is very friendly towards using multiple CPUs, each worker can run on a different CPU.
A JS app using a single process which handles all request sequentially on a single CPU. Intensive work like reading files or accessing the database may be handed of the alternate processes leaving the single process to handle running JS. Idle memory usage is higher, but high load memory usage may be lower, as it does everything with a single process. Max throughput might be lower, depending on whether the bottleneck is CPU/Network/DB/Network. Spreading loads across multiple CPUs could potentially be done using multiple JS instances with a load balancer - but you'd have to take care not to rely on anything in memory that should be shared between requests. That said, PHP can not share memory between requests, requiring file system storage, so this is sometimes a capability advantage of JS.
TypeScript full stack is really quite impressive. With a library like tRPC instead of making fetch requests and parsing JSON we just make function calls on the client, the lib handles the actual web work, and TypeScript types the function calls giving us a typed result as if it was a local function call. I would go for TypeScript for a "casual" full stack build, and consider something like Go if wanted to make a really performant API, knowing that I'll need to do more work if I want a frontend.
I'm a fallen in love with PHP. I've seen its evolution from 5.4 version (when haters had real reasons to hate it) to 7.0 version, when everything changed and PHP came of age. Now, with new improves of 8.2 version, PHP feels robusted and renewed, so current critics about PHP are, in many cases, outdated sign about language changes.
All languages have similar features only syntax may be different. What decides better language is underlying high level features. Example using all cores for processing, non blocking io like nodejs, or security in the complied application processor ide. Otherwise ayntaxwise what difference does it make
I think PHP is just optional these days. For backend development, alternatives like Python, Go, Node.js, and ASP.NET may offer better performance in certain areas. Similarly, PHP is becoming less relevant in frontend development; many JS frameworks or JAM stacks dominate it. Also, the new WordPress versions are moving away from PHP. So, it's less popular than before. And GitHub stats shows Python and Typescript are the most popular languages.
Statements like these feels we still don't know the purpose of the programming languages we go for, High Level, Low Level, Scripting/Interpreted Languages, Compiled languages etc. and in each domain the languages do what they can do best.
So please stop dragging languages down, because the Node.js you stated is not a language but a runtime environment like BunJS.
You make the assumption that because websites are powered by php, people are coding with PHP. A lot of PHP websites are free CMS like WordPress, Joomla etc.., that doesn't mean people actually code with PHP. And for some it's because there is no option: many free CMS are PHP based so we just go along.
Php for life ❤️
You forgot "Laragon" in "PHP IDE" section, it's better then xampp and mamp on windows.
Sadly, none of mentioned here XAMPP, MAMP, ServBay nor Laragon is IDE
my two cents about "why PHP?": dev.to/robertobutti/why-php-2e4h
WRONG! PHP IS the worst programming language! Developers should pivot away from that hot garbage language!
I created komodie.com solely off PHP and standard JavaScript. Fast and reliable.
I love php 😘 and Java 😘
Php laravel have everything in simple , powerfull and some people say php slow but wen u start using laravel with livewire its fasttttttttttttt, even in spa's
uneasy lies the head that wears the crown