Asp.Net VS Php

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

aspnet-vs-php1

Be Sociable, Share!

16 responses to Asp.Net VS Php

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.

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.

About PHP IDE there lots of IDE available now.
PHPEclipse
NetBeans PHP
Zend Studio
EclipsePDT
Dreamweaver
NuSphere PhpED

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…..

Hi Bryan Migliorisi,
I guess that I’m the only one who’s acknowledged and appreciated your comment.

I was wondering what class to take in order to created a web server page. In the pass, I’ve learned XHTML, CSS, JavaScript, Visual Basic, and ASP.NET.

I was thinking about taking PHP class, but when you pointed 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”,
and since I’ve already known Visual Basic and don’t have time learn other language, I decided to take Advance Visual Basic class instead.

80)

Thanks.
Kim.

Leave a Reply