Whats the diff beween php and asp.net?

  • Thread starter Thread starter Gowtham G
  • Start date Start date
G

Gowtham G

Guest
why nowa days many websites are started moving towards .....php
....if u see php takes huge time to create a website because we need to write the code for each and everything......but in asp.net its just drag and drop only......
 
Most people here are missing the point of the topic. It depends on what you are developing.

If you are making a large scale social networking website,, it will be better for you to use ASP.net. ASP.net uses the .net framework and has two different ways of being developed (in Visual Basic or C# language). Also, ASP.net is more secure as it has built in scripts that allow you to validate user input, saving you from writing more code and tracking errors.
PHP on the other hand is better for simple, small web applications. It'as easy to write, you don't have to declare variables, there are a million+ tutorials on it, and it's extremely easy to communicate with a database with. PHP is not good, however, for large scale websites because it has no official framework. There are a number of framework's you can download (CakePHP, Zend), but who wants to take the time to learn how to use them when they are not really official or built into the language?

And it all comes down to this; if you never had any experience with a programming language before, I would recommend you go with PHP because ASP.net, although better for large scale applications, is difficult to learn. Let me show you how I track an array called errors in ASP.net vs PHP.
When I develop server side applications, I track errors into an array (IP address errors, cookie errors, things that a high end website require). When I use PHP, the programming language will figure out how many variables in an array I use. In ASP.net, it does not. I have to declare how many error array variables I need and then write a bunch of code to figure out how many I actually use.

ASP.net:
' Determine if any errors occured
' First, determine how many array variables are not blank
total_errors = 0
For i As Integer = 0 To 12
If errors(i) <> "" Then
If total_errors = 0 Then
total_errors = 1
Else
total_errors = total_errors + 1
End If
Else
i = 13
End If
Next
' Now display each error that occured
If (total_errors > 0) Then
Response.Write("<div style='color: red; font-weight: bold;'>The following errors occured:<ul>")
For i = 0 To total_errors Step 1
' Double check to ensure this error is not blank
If errors(i) <> "" Then
Response.Write("<li style='color: Red;'>" & errors(i) & "</li>")
End If
Next
Response.Write("</ul><br />Please fix your errors and try again.</div><br />")
' Display the registration form
registration_form(username, realname, email, upass)
Else
Response.Write("<h3>Successful!</h3>")
End If



PHP:
// Error check
// If any errors occured, show step one of the validation again
$errors = count($error);
if($errors > 0) {
echo '<div style="color: red; padding: 14px;">
<b>The following Errors Occured:</b><br />
<ul>';
for($i = 0; $i <= $errors; ++$i) {
echo '<li>' .$error[$i]. '</li>';
}
echo '</ul>
</div>';
step_1_form($username, $realname, $email, $pass);
} else {
echo '<h3>Successful!</h3>';
}

Not exactly the same pieces of code, but they are both for registration forms.As you can see, to determine how many error array variables I have taken up, I need to write a bunch of extra code, where as PHP does not require this. I'm not sure if there is a function to find how many variables are actually used in an array in ASP.net, but the overall point is, ASP.net can be very inconvenient and annoying sometimes.

Personally, I prefer PHP, but it really is more difficult to develop large scale applications in it. I hope that helps you a little more than the generic answer on here.
 
Back
Top