Archives

July 2016
December 2015
December 2013
April 2013
January 2013
December 2011
November 2011
September 2011
December 2010
November 2010
March 2010
February 2010
January 2010



PHP vs ASP and JSP 11-2-2010

In this article we are going to focus on the similarity between PHP and ASP, where JSP can be considered also one of the group partners. Anyway, let us start with the code.


1- Your first page


PHP



<?

print "Hello World";

?>


ASP



<%

Response.write("Hello World")

%>


JSP



<%

System.out.println("Hello World");

%>


2- Remarks


PHP



<?

// Put your notes here

?>


ASP



<%

' Put your notes here

%>


JSP



<%

// Put your notes here

%>


3- For loop


PHP



<?

for($i=0;$i<=100;$i++){

print $i. "<br>";

}

?>


ASP



<%

For i=1 to 100

Response.Write(i&"<br>")

Next

%>


JSP



<%

for (int i=0; i<=100; i++) {

out.println(i+"<br>");

}

%>


4- If condition


PHP


<?

if($a==""){

print "empty";

}

?>


ASP


<%

if a = "" then

response.write("empty");

End if

%>


JSP


<%

if(a = ""){

out.println("empty");

}

%>


5- Cookies


PHP


<?

setcookie("username","admin");

// Set cookies username with the value admin

$value = $_COOKIE["username"];

// Get cookies username into the value variable

?>


ASP


<%

Response.Cookies("username") = "admin"

' Set cookies username with the value admin

value = Request.Cookies("username")

' Get cookies username into the value variable

%>


6- GET and POST


PHP


<?

$user = $_GET[username];

// Receiving the value username from GET method into user variable

$pass = $_POST[password];

// Receiving the value password from POST method into pass variable

?>


ASP


<%

user = Request.QueryString("username")

' Receiving the value username from GET method into user variable

pass = Request.Form("password")

' Receiving the value password from POST method into pass variable

%>


So, as you see the deference is not that much, and if you learn one of them you will get the other through this kind of comparison.


Regards,

Wail Shalabi.


 

Leave your comment
* Name:
* Email:
* Subject:
* Comment:
* Confirm: Please write the code above
 

Contacts

Mob: +4915753779176
E-Mail: wail(at)wailshalabi.com
Web: www.wailshalabi.com

Feed back form

 
Tags

PROJECT WEBSITE ABILITY LIKE SEARCH NIZAR VALUE QABBANI USERNAME NAME RESULTS USING WHERE ONE MYSQL TEXT APPLICATION NEW FOLLOWING DATA POST CODE TITLE EXAMPLE KNOW SEE SERVER KASS TIME WORDS COM OUT TYPE PRINT FILE HEAD VIDEOS NOT HOPE INTERNET WOULD TAG EMAIL ANY FRIENDS FORM AFTER PROGRAM GOING WHILE WORLD MORE SAME HTTP LAST ASP WILL PASSWORD CLIPS WRITE DEAR AGAIN MOBILE FINALLY NUMBER EVERY SENT COOKIES CSS PUT OPEN WORD SEND BACK WWW THEM SCRIPT TELL NOW PHRASE INPUT DATABASE CONNECT GOOGLE FTP TOP VARIABLE QUIZ SHOOF JSP