Asp.Net VS Php
- Monday, April 20, 2009, 1:34
- Programming
- 7,880 views
- 18 comments
Asp.net and PHP are most frequently in use for web application development. In this article i evaluate Asp.net and PHP on basis of some most essential factors required for web application. Although PHP is programming language and Asp.net is a framework but still at the end same objective accomplished from both.
Asp.net Programming Languages
Asp.net developers can use different programming languages for coding mainly C# and VB.net
C#
C# syntax is similar to C++, programmers worked in C++ can easily develop application in asp.net using C#.
VB.net
VB.net is the new version of visual basic; VB.net is introduced with pure object oriented programming capabilities whereas Visual basic is object based. Developers worked in VB can easily switch to vb.net with minimum learning efforts because the syntax is quite similar.
Object oriented
Asp.net prgramming languages are pure object oriented supports inheritance, abstract class and function overloading and overriding, private public and protected variables. PHP 5 supports object oriented but we can’t say that it’s a pure object oriented language like asp.net. In asp.net each varible used within the class require declarion but in PHP any value can be assigned to the variable due to its loosely type nature as shown in the figure below.
employee
{
public function setName($name)
{
$this->name = $name; //Automatically creates $name variable for employee class
}
public function getName()
{
return $this->name;
}
}
$employee = new employee();
$employee->setName(”Hitesh”);
echo $employee->getName();
echo “<br />”.$employee->name;
PHP also missing one feature of polymorphism in object oriented language which is function overloading. Function overloading allow the programmers to declare more than one function with same name but different parameters.
Multi-tier Programming
In asp.net user interface, business logic and programming language can be kept separate. This programming model reduces the work of programmer because each layer works independently. Fewer efforts are required to add any new functionality in the web application.
In PHP you can found PHP code within html, PHP code is enclosed in between <? php some code here >.Programmers find it difficult to look for PHP code in html.
Database Support
Asp.net supports multiple database platforms including Oracle, SQL Server, Microsoft Access and etc. There are different database programming libraries to access the database. SQL server is considering most preferable RDBMS for asp.net; system.data.sqclinet libraries contain number of database object, function and methods with different parameters.PHP mostly use oracle and mysql as database, oracle database accessed through ODBC drivers and optimize for PHP.
Following are the list of database which are compitable with PHP.
DB++
FrontBase
filePro
Firebird/InterBase
Informix
IBM DB2 — IBM DB2, Cloudscape and Apache Derby
Ingres — Ingres DBMS, EDBC, and Enterprise Access Gateways
MaxDB
Mongo
mSQL
Mssql — Microsoft SQL Server
MySQL
Mysqli — MySQL Improved Extension
OCI8 — Oracle OCI8
Ovrimos SQL
Paradox — Paradox File Access
PostgreSQL
SQLite
SQLite3
Sybase
Integrated Development Enviroment
Asp.net has strong IDE visual studio with lot of controls which gives privileged to programmers to work with ease and faster as compared to other programming languages.There are number of different IDE availables for PHP, developers have to look for the best one.
Asp.net data controls
There are rich amount of data controls in visual studio to work with database data. Following are the visual studio controls through user can view, add, modify and add the data.
Following are the data controls in asp.net
• GridView
• Datalist
• Detailsview
• FormView
• Repeater
• SqlDataSource
• AccessDataSource
• ObjectDataSource
• XmlDataSource
• SiteMapDataSource
• Report Viewer
In PHP massive amount of coding is needed to access and display data on web application. Developers have to develop their own controls due to lack of ready made control in PHP.
Reporting with Asp.net
Asp.net use crystal report as reporting tool, variety of reports can be developed from basic to expert level. Report viewer control is employed by developers for reporting purpose.
In PHP there is no such tool for web application reports. Again, developers have to do lot of work to generate reports from database.
Exception Handling
Asp.net supports strong exception handling to control the application crashing and errors. Exception handling was the missing feature in PHP 4. In PHP 5 this capability in incorporated to make PHP as robust language and compete with the leading technology like asp.net.
Multithreading
The new processing architectures motivates multithreading to optimize the performance. PHP lacks the functionality of multithreading which can leads to serious problem for future applications.
Of course multithreading is hard, and it should be offered with a good concept keeping track of deadlocks, race conditions, and data locks. The PHP-Java Bridge gives a solution for parallelizing the retrieval of multiple web pages for processing instead of doing this sequential using normal PHP code, showing a nice performance enhancement. It would be good however if this could be done natively inside PHP.
Garbage Collection
Garbage collection incorporated in earlier days of asp.net. This feature of asp.net reduces memory space usage by automatically remove object which are not in use from long time.
PHP 4 lack of this feature but in PHP 5 this thing is cater by constructor and destructor.
Operating system Platform
PHP won the race in operating system support; PHP supports multiple platforms including windows, sun Solaris and Linux whereas asp.net runs on Microsoft platform only. Mono is the project which will bring asp.net on Linux but still it is in progress and takes time to enter in the market.
Proprietary VS Open Source
Asp.net is proprietary product of Microsoft and requires licensing cost. PHP on the other hand is free of cost without any license. Companies want to go with asp.net have to consider the cost factor.
Web Server
Asp.net supports IIS (Internet Information Server) and PHP supports Apache, Internet information server.
Support & Documentation
Asp.net developers can refer MSDN for support and documentation which is centralize and authentic source. PHP support and documentation is widely available with different implementation, tough for developers to identify the best source.
Asp.net Vs PHP Comparison Grid
About the Author
Related Tutorials & Articles
When it comes to discuss web application the first thing come into mind is client and server architecture. Client is the entity which always request to the server by sending some arguments or page request in response server receive the request, process it and return the pure html to the browser. Interaction of user with server...Read more
In past JavaScript is used by developers for client side scripting, but now developers have several option to add the functionality of JavaScript by using other tool and libraries. jQuery is also one of the best libraries for adding javascript, ajax features in the application, although the same task can be performed through javascript but...Read more
In this tutorials, I will explain about linker, linkage and its type in detail with examples to make things easy for understanding. The topics discussed in this tutorials are very important for the computer science students as well as for the programmers working in the IT industry. Linker A linker is a program that takes one or more...Read more
If you own a website then you may be interested to see how many users are currently online on your website or you may have integrated third party online user tracking system on your website or you may written your own custom online users application that tracks users activity on your website and periodically remove...Read more
Joost recently email its entire viewer that they had stopped broadcasting videos through their application now joost user not able to access the videos. Joost took this decision because they are moving from application base access to web base access by offering the streaming to viewers through their website joost.com. It's difficult to understand why joost...Read more
18 Comments on “Asp.Net VS Php”
Trackbacks
Write a Comment
Gravatars are small images that can show your personality. You can get your gravatar for free today!


























I’d just like to pick up on a few points you made. I was an ASP/Visual C++ developer for a few years before I moved to PHP so I’m pretty familiar with both languages.
OO
- Sure, PHP is missing some of the OO features of C++/C# but I wouldn’t say it’s OO support is weak. PHP 5 introduced a lot of OO functionality.
Multi-tier Programming
- A lot of PHP frameworks support the MVC pattern these days. Business logic is kept separate from the view scripts. We also use Java with PHP on our servers to handle certain jobs.
Database drivers
- I’d argue that PHP has better database support than ASP.net. In fact Microsoft themselves contribute to the SQL Server module in PHP. While it’s more common to run MySQL, Postgres and Oracle there are many other databases that PHP can support.
IDE’s
- PHP does suffer a bit from not having a standard IDE (i’ve probably used 4 or 5 in my time as a PHP developer) but with the recent acquisition of Sun by Oracle (who own Netbeans and Eclipse respectively) there will hopefully be a big push in PHP IDE development.
Support & Documentation
- One of the things I really hated when I developed Microsoft software was the documentation. I think the MSDN is really hard to navigate and is really lacking in example code and user input (it may have improved recently as I haven’t used it in the last year or so). The PHP documentation site is excellent and although it may appear in a lot of places, these are just mirrors. The documentation is standard across them. There are also library and framework community sites and they tend to have excellent documentation and API references. I know that ASP has really helpful community sites too, in fact they’re often a lot better than the MSDN.
I enjoyed your article but I do feel it’s a bit biased towards ASP.
Solid documentation: php.net ?
Many DB support: http://php.net/manual/en/refs.database.php ?
Disclaimer: I am a C# developer.
I want to point out that ASP.NET isn’t a language - it is a framework. C# and VB.NET are the languages. PHP is not a framework, it is a language. For this reason, your comparisons are invalid. PHP has MANY frameworks, such as CakePHP, Codeigniter, etc.
Also, I want to note that ASP.NET certainly does run in other platforms. The open source Mono project is an open source implementation of the .NET libraries. It runs on any flavor of Linux or BSD and Mac OSX as well. This allows you to run your site on Apache, lighttpd, etc.
This blog post disappointed me.
Good job comparing a framework (.Net) to a language (PHP). PHP has RAD and “Data Controls” too, if you use frameworks. There’s even a PHP framework (PRADO) that works on the same principles as ASP.Net, but we PHP programmers tend to like MVC more than event-driven programming. PHP4 and PHP5 both have garbage collection. That has nothing to do with constructors or destructors. It’s just a subsystem that automatically frees unreferenced memory. Duck typing (variables don’t have to be declared and take the type of the value assigned) doesn’t mean PHP’s OOP is any weaker. In fact, duck typing has nothing to do with OOP. It’s just a neat feature dynamic languages have, that make for much more enjoyable coding.
Hi I m Shoaib Usman. I m desktop application developer (in VB.Net) and want to switch in to web development but still i m confusing to choose the language PHP or ASP.Net. Is any body here to advice me so that i will choose the web language appropriately. My email is ” shoaib_usman@yahoo.com “.
Another thing to note about PHP here: Apache and IIS are not the only web servers that PHP can be used with. It can be setup with ANY webserver as a CGI or FCGI program. Lighttpd, Zeus, Caudium and many others can be used.
For shoaib Usman,
if u are vb.net developer, go for asp.net because it will take less time to learn asp.net.
Visual Studio Express 2008 / SharpDevelop+ Mono Framework (supports .net 2.0 and 3.0) on Linux + mysql/sqllite/sqlce/vistadb/db40/postgre/ingres/… = 0$
You have nicely compared a framework to Programming Language. Although when comparing with the longevity of Software / Web Applications, PHP mostly wins on all platforms.
Develop once and run on platform can be achieved because, Apache can be used to run on both platforms. This is not the case with .NET Framework.
Secondly, apart from the IDE discussions, and OOP discussion, there is big debate on whether or not code lives when next version is released. With PHP 4.0 to php 5.0, the developers who developed their application in php 4.0 live at peace even though the new development environment / production server is running php 5.0. This is seldom, not the case with .NET Framework. I have heard numerous stories of developer crying out load, when 2.0 was released and developers developed their 1.1 framework application.
I still feel that PHP is a lot stronger than .NET framework in performance aspects. When giving ease to developers, .NET IDE definitely wins, but is the development work Easy or Hard. If hard, then is there any value towards .NET development.???
I rest my case.
Good
About PHP IDE there lots of IDE available now.
PHPEclipse
NetBeans PHP
Zend Studio
EclipsePDT
Dreamweaver
NuSphere PhpED
For maintainable code and rapid development use CakePHP.
It uses MVC
Hi All, I would just like to add that it is hard to rich an agreement on which one is better, since its all depends on a person and its needs. I believe best compare method would be to hear from both PHP and ASP.NET developers, see what features and functionality PHP and ASP.NET provide, how it can be utilised and what are implications (not just using HTML-alike murk-up but also advanced development).
I can start: Since I am C# fun (coming from VB6/VB.net/C++/Java background), I can say that ASP.NET offers ability to compile web application into a single (or multiple) library with embedded resources making code storage relatively secure, since it is all MSIL and cannot be downloaded or viewed in browser.
I m doing bs cs in pakistan. Here What i see market of php is far more high than asp.net but the Pay is high in asp.net . what i dont understand is maximum sites are made for small buisness & personal websites uses php but WHY PAYS IN PHP IS LESS OFFCOURSE JOBS ARE MORE. I HAVE STUDIED ASP.NET SOME CONTROLS & DATABASE & I M FAIR IN C++ . WHAT I WANT TO ASK WHICH TECHOLOGY SHOULD I GO (PHPORASP.NET) OFFCOURSE FIRST PRIORITY IS FUTURE THEN PAY. please guys help me out you all are technology master a little help will give me path to flow inshalla. if u like to mail answer spent_ure_life_ure_way@yahoo.com THANKS…..
You seem to have some points here but you missed a lot too. PHP is a very good technology but I have a lot of reasons that I choose ASP.Net or .Net in particular. One, if you are a .Net Developer, you are not limited to developing applications to web only. Using .Net, you can develop applications for desktop, web and mobile applications using one syntax or PL like VB.Net, C#, etc. Unlike PHP, it is a good technology for the web ONLY!! As others who commented here, .Net has also an opensource implementation in Mono (http://www.mono-project.com - backed by a company called Novell) and it has also it’s standard IDE in MonoDevelop. So, as a .Net developer you don’t have to worry about bringing your applications to run on Linux, Mac OS, Free BSD, Windows, etc. And what I like about ASP.Net Development over PHP is the PRODUCTIVITY in developing applications. Microsoft make it really easy for developers to develop applications on their platform by providing excellent developer tools. Let me reiterate that ASP.Net is a framework and it is free. There are also free tools provided by Microsoft called Visual Studio Express version. In CMS tools, there are also many free CMS tool you can choose from like Umbraco, DotNetNuke, Sitefinity, Graffitti, etc. So, ASP.Net as a framework compared to PHP has lots of advantages especially if you are a .Net Developer you can do a lot using the framework. But as a Software/Web Engineer, I don’t limit myself to .Net and will still use PHP if the need arises. It’s cheaper though (I mean the hosting)…
I like php the most.
My future depends of php.
long live php.
good articles.
Thank you all;your information really helped me.
About 7 years ago when I was at high school(about 16 years old),I used to work with VB,but I haven’t worked till now;
Now I wanna start web programming and after a lot of researches I choose PHP though I’m Iranian and MS products are free here(illegally).
If anyone here think he can help me please mail me:023.rad@gmail.com