Why PHP is better than ASP.NET


I have been dealing with the PHP vs ASP.NET comparisons for the past few years and have gotten frustrated on more than one occasion with either clients or other software engineers arguing one side or the other without knowing some basic facts. Here’s my 2 cents on the debate.
First off, I think it is very important to you as a reader to understand my background. 8 years of my career was dedicated to game development for the Xbox and PS3. Games for these consoles are programmed in C++ and using Visual Studio. This is important because someone with that background is going to gravitate to ASP.NET before PHP.
The last 3 years I have been working on a number of different web projects and apps. This includes most of them built with ASP.NET. However, I worked on one large PHP project where I was the lead and primary engineer and several WordPress websites with custom themes. During that time, I built an entire RESTful API using Laravel that I continue to support to this day.
I am fully aware what you are thinking right now. Just because I’ve done ONE PHP big project, doesn’t make me an expert. You are correct, I am not a PHP expert. However, the arguments I make in this post would not change with experience level.
For the record, I am NOT pro ASP.NET or pro PHP. There are some situations where PHP is the best tool for the job, and there are other cases where ASP.NET is the best. I have actually fought for the use of PHP in a lot of projects.


You can read so many articles that give a fair shake down of PHP and ASP.NET. This post isn't meant to do that. This post is to point out what PHP enthusiast are conveniently leaving out of their posts on why PHP is better. In my opinion these are pretty crucial oversights!

Apples to Oranges

In order to compare 2 things they need to be similar. Most people (even so-called experts) don't understand that comparing PHP to ASP.NET is not apples to apples. PHP is a programming language. ASP.NET is NOT a programming language. The language used for ASP.NET is generally C# (VB.NET can also be used, but rarely ever is).
Please make sure you understand that previous paragraph! Let it settle and be processed. If you read any other articles comparing PHP to ASP.NET or WebAPI it is probably written by someone who doesn't understand both technologies. PHP is a programming language, ASP.NET is a web framework.

PHP vs C#

So let’s compare an apple to an apple, PHP vs C#. Here is what Google gives as a definition to each:
C# - An object-oriented programming language in development from Microsoft, which is intended to combine the computing power of C++ with the programming ease of Visual Basic.
PHP - PHP is a server-side scripting language designed for web development but also used as a general-purpose programming language.
Already Google is skewing reality. C# is more widely used in NON-web applications than PHP is used as a general purpose programming language. How many people can say they’ve used PHP for a non-web application? C# is used for Windows phone apps, tools, and even cross platform mobile frameworks (MONO).
One thing that Google does get right is saying C# is an object-oriented programming language where PHP is NOT. No, it didn't just miss that in the definition. PHP is NOT an object-oriented programming language. You can use it to mimic object-oriented practices (as you can any language) but it is not ingrained into the language itself as C# is.

Language Performance

As someone who has worked in games I understand the importance of performance. A lot of comparisons that are made conclude that PHP is faster at the core level. I’ll give that one to PHP. However, any engineer will tell you that modern hardware is so fast anyways that the core language speed really isn't that relevant anymore. If it was relevant, everyone would be programming in ASSEMBLY which is a low-level language that can talk directly with the hardware. The reason no one does is because it takes many lines of codes to do the most basic operations and building an app with ASSEMBLY would take years to complete.
Since newer faster hardware has been developed new languages have been developed to take advantage of them, including C#. C# was built to make it easier for engineers to build apps quicker at the expense of a loss in overall performance (again, on modern hardware this is negligible).
I say all that to state that the performance of the language itself really isn’t what makes a program run faster or slower. Instead, it is how the code is written and architecture that determines how well it will perform.
In my experience, a lot of performance can be gained by using parallel processing (aka threading). Parallel processing allows multiple chunks of code to run at the same time in parallel. PHP does NOT support threading. C# not only supports it but makes it so simple that in most cases it only requires you to add the keyword async/await to a function (**if you’re using an SDK or existing code that was built with async in mind).
There are a number of other reasons why C# is better than PHP, but in my opinion the lack of threading support is the only argument needed.

The Real Comparison

As I said at the beginning of this post, we need to be comparing apples to apples. So what is the apple to ASP.NET MVC and WebAPI? Well, there are a lot of apples out there. These are generally called frameworks and you can see a lot of them by just Googling ‘PHP frameworks’.
I only have experience with the Laravel framework, so I can only provide comments about that one. I will say that the Laravel framework is an amazing framework and does a lot that the ASP.NET frameworks don’t’ do out of the box. The engineers that built Laravel have a lot of experience and put a lot of thought behind their framework, merging be best of the best from other PHP frameworks and even ASP.NET frameworks.
If you’re a big supporter of PHP, go back and re-read that paragraph over and over so you feel better about this post. Just to re-iterate, the Laravel framework (built with PHP) has more features out of the box than ASP.NET MVC or WebAPI. I am a huge fan of Laravel. The only thing I don’t like about Laravel is that I am limited by what PHP can do.
Laravel (and PHP) is great for specific scenarios. But when it comes to big projects and enterprise level software, you are going to hit your limits with Laravel far faster than you would with ASP.NET. Limits including scalability, maintainability, and future platform support.
Here's a feature comparison of apples to apples: http://vschart.com/compare/laravel/vs/asp-net-mvc-framework

Outdated Information

When reading any article or post on this topic, make sure you check the date. Most of the time you are reading an old article with outdated information. Microsoft tools (Visual Studio) now have free offerings (FREE!). Windows servers now cost almost the same as Linux servers (albeit a bit more expensive still). And they are now embracing the open source/cross platform community as evident by this article:

Community Support

One last argument that I want to address is the go to statement that every PHP engineer makes: “The PHP community of developers is bigger than ASP.NET”
Yes, there are more PHP developers than ASP.NET developers. I agree. However, as I have said in this post, PHP is comparable to C#, not ASP.NET. The PHP community has a lot of people behind it but they are spread out among all of the PHP web frameworks. I don’t know the exact number, but I’m willing to bet the number of C# developers is very comparable to PHP developers (not even including C and C++ developers that can easily transition to C#).
So, to make the more accurate comparison, are there any PHP frameworks out there that can say they have more developers supporting them than the ASP.NET frameworks do? No. The ASP.NET developers are all backing MVC and WebAPI instead of everyone going out trying to build their own web framework like the PHP community is doing.
So the Final result is that PHP is much Better than ASP.NET :)