There's been a lot of discussion about this topic and I guess everyone has different opinions about it. I am a full-time freelance developer and do projects with PHP and ASP.NET so I may have a more neutral opinion about the two.
In the old days if you asked me to compare PHP and ASP, I would have said PHP without any hesitation. ASP was cumbersome to me with way too much overhead and lacked the OOP aspect. But these days with the newer.NET frameworks it's much harder to make up my mind.
Both languages have their own pro's and con's. I come from a C ++ background and writing code with C # and PHP both give me a lot of satisfaction, so on the style and object oriented coding level they are both on equal ground for me. I know ASP.NET has much better OOP support, but for what I need and the projects I do, PHP is fine. Without comparing too much low level differences between the two engines.
The things that stand out most about PHP are:
- Platform Independence – And yes, I know there's the mono framework that supposedly makes ASP.NET independent. Well in my opinion, if it was not natively build to be platform independent then it's not. I do not like hacks to make things work.
- Easy Deployment – I've never once, deployed and ASP.NET application from a dev environment to a live environment without any issues. With PHP it's almost always flawless.
- An Abundance of Resources – You always find answers to questions, problems and third party classes to do things much easier than with.NET resources. Due to the open source nature of PHP development.
The things on the other end that I like more about ASP.NET development:
- Access to the .NET Framework (CLR) – The libraries has everything you need built-in. There's no need to download a class to do nicely formatted email or encryption, it's all there.
- Better UI controls out of the box – The grid components make it quick and easy to slap together a data viewing or editing screens. I suppose with add-ons to PHP like jQuery the same can be achieved.
- Good Debugging Support – I am using Nusphere's PhpED for development and it comes close with its debugging functionality, but nothing beats Visual Studio's debugging support.
So which one do I choose?
Well, if I were new to web development and had to choose. I'd choose PHP. But I would also invest the time to learn ASP.NET in C # of course, not VB.NET.
I'll continue to support both languages in my business. There are times when PHP is more suitable and others when ASP.NET makes more sense. A lot of my Government work also requires ASP.NET because of their licensing agreements with Microsoft. So it makes sense to learn both.
If you're interested in quickly running through a comprehensive crash course in PHP with step-by-step examples visit http://www.php-skills.com
To learn ASP.NET go to http://www.ASP.NET for learning material.