Basic PHP syntax for front-end, php syntax for front-end _ PHP Tutorial

Source: Internet
Author: User
The front-end learns the basic PHP syntax and the front-end php syntax. Basic PHP syntax for front-end learning, front-end php syntax Directory [1] code identification [2] comment [3] output [4] Computing expression [5] Before case sensitivity PHP is a powerful front-end for creating dynamic interactive sites learn the basic syntax of PHP, front-end php syntax
Directory [1] code identifier [2] comment [3] output [4] Computing expression [5] Before case sensitivity

PHP is a powerful server-side scripting language for creating dynamic and interactive sites. PHP can contain text, HTML, CSS, and PHP code. it is executed on the server and the result is returned to the browser in plain text.

Code ID

PHP code And can be placed anywhere in the document.

 

The PHP statement ends with a semicolon (;). The close tag of the PHP code block automatically indicates a semicolon.

 

Note

PHP supports three annotations, including two single-line annotations and one multi-line annotation.

 

Output

In PHP, there are two basic output methods: echo and print

Print can only output one string, and always returns 1

Echo can output more than one string. echo is faster than print because it does not return any value.

[Note] echo and print are both Language Structures. echo or echo () and print or print () can be used with or without parentheses (), there must be at least one space between the echo or print keyword and the string.

 ";    echo "I'm about to learn PHP!
"; echo "This", " string", " was", " made", " with multiple parameters.";?>
 "; Print" I'm about to learn PHP!
"; // This row has an error because print can only output one string: print" This "," string "," was "," made "," with multiple parameters. ";?>

Calculation expression

Unlike HTML and CSS, you can write computation expressions in PHP.

 

Case sensitivity

In PHP, all user-defined functions, classes, and keywords are case-insensitive, but all variables are case-sensitive.

 ";    //Hello World!    echo "Hello World!
"; //Hello World! EcHo "Hello World!
";?>

[Note] "." indicates a string connection. in other programming languages, "+" is generally used.

 ";    //My house is     echo "My house is " . $COLOR . "
"; //My boat is echo "My boat is " . $coLOR . "
";?>

The examples Directory [1] code identification [2] comment [3] output [4] Computing expression [5] Before case sensitivity, PHP is a powerful way to create dynamic interactive sites...

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.