What is the syntax difference between php and asp

青灯夜游
Release: 2023-04-06 16:14:02
Original
2714 people have browsed it

What is the syntax difference between php and asp

Let me introduce to you some syntax differences between php and asp:

1. Delimiter

PHP The delimiter is <? ? >;The delimiter of ASP is <% %>

2. Case sensitivity

PHP is size sensitive Write; ASP is not case sensitive.

3. Comments

PHP has two kinds of comments: single-line comments (//) and multi-line comments (/**/); ASP uses ' as comment symbol .

4. Declaration of variables

PHP uses $ to declare variables, for example: $a; ASP declares them directly, for example: a .

5, if statement

PHP

if (条件){
  语句
}
else{ 
  语句
}
Copy after login

ASP

If 条件 then
   语句
Else 
   语句
End if
Copy after login

6, For statement

PHP

for ($i=m;$i<=n;$i++){
   语句
}
Copy after login

ASP

For i=m to n
   语句 
next
Copy after login

7. While statement

PHP

while (条件){ 语句 }
Copy after login

ASP

Do while 条件
     语句
loop
Copy after login

8. Import statement

PHP

require(“”)
require_once(“”)
include(“”)
Copy after login

ASP

<!--#include?file=””-->
Copy after login

9. Jump statement

PHP

Header(“location:a.php”)
Copy after login

ASP

Response.redirect“a.asp”
Copy after login

10. Get the data submitted by the form

PHP

$_POST[“a”]
$_GET[“a”]//url数据
Copy after login

ASP

Request.form(“a”)
Request.querystring(“a”)//url数据
Copy after login

11, global variable SESSION

PHP

$_SESSION[“a”]
Copy after login

ASP

Session(“a”)
Copy after login

12, class

PHP supports classes, ASP does not support classes

The above is the detailed content of What is the syntax difference between php and asp. For more information, please follow other related articles on the PHP Chinese website!

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template