Front-end PHP basic syntax, front-end PHP syntax
Directory
[1] Code identification [2] note [3] output [4] calculation expression [5] case
Previous words
PHP is a powerful server-side scripting language for creating dynamic, interactive sites. PHP can contain text, HTML, CSS, and PHP code, executed on the server, and returned to the browser in plain text.
Code identification
The PHP code ends and can be placed anywhere in the document
PHP //?>
The PHP statement ends with a semicolon (;), and the close tag of the PHP code block automatically indicates the semicolon
PHP "Hello world! " ;? >
Comments
PHP supports three types of annotations, including two single-line comments and one multiline comment
PHP// This is a single-line comment #这也是单行注释/ * This is a multiline comment block which spans multiple lines */?>
Output
In PHP, there are two basic output methods: Echo and Print
Print can output only one string, and always returns 1
Echo is capable of outputting more than one string, and echo is slightly faster than print because it does not return any value
[Note that both]echo and print are language structures, with either echo or Echo (), as well as print or print (), with or without parentheses, and at least one space between the echo or print keyword and the string
!--?
php echo
"
php is fun!
"
; echo
"
Hello world!
"
; echo
"
I ' m about to learn php!
"
; echo
"
this
" ,
"
string
" ,
"
was
",
"
made
",
"
with multiple parameters.
"
; ?
PHP "PHP is fun!
" ; " Hello world!
" ; " I ' m about to learn php!
" ; // The row is faulted because print can only output 1 strings " This " " string " " was " " made " " With multiple parameters. " ;? >
evaluating expressions
Unlike HTML and CSS, you can write calculation expressions in PHP
PHP // *3;? >
Uppercase and lowercase
In PHP, all user-defined functions, classes, and keywords are case insensitive, but all variables are case-insensitive
PHP //Hello world! " Hello world!
" ; // Hello world! " Hello world!
" ; // Hello world! " Hello world!
" ;? >
[note]. The number represents a string connection, in other programming languages, usually with the + sign
php $color ="red"; // My car is red " ""
" ; // """
" ; // My boat is " ""
" ;? >
http://www.bkjia.com/PHPjc/1087042.html www.bkjia.com true http://www.bkjia.com/PHPjc/1087042.html techarticle front-end PHP basic syntax, front-end PHP Syntax directory [1] code identification [2] note [3] output [4] calculation expression [5] case before PHP is a dynamic interactive site to create a strong ...