Home  >  Article  >  Backend Development  >  PHP Basic Syntax Chapter 1_PHP Tutorial

PHP Basic Syntax Chapter 1_PHP Tutorial

WBOY
WBOYOriginal
2016-07-13 17:44:59767browse

one. PHP annotation method

1. // (Single line comment) 2./**/ (Multi-line comments) 3.# (mostly used in Unix SHELL) 2. Embedding method

You can specify it yourself, generally

//Recommended to use <% ...%> Three. Citing files

include and require

1.include is mostly used in process control to make the process simpler

include("MyIncludeFile.php") 2.require is mostly used at the beginning of the program, and becomes part of the program after loading

require("MyRequireFile.php") 4. Variables in PHP

1. Convention on variable names

(1)Variables in php are case-sensitive

(2) The variable name must start with the dollar sign $

(3) Variable names can start with _

(4) Variable names cannot start with numeric characters

$mystring="I am a string"; $NEWLINE="Newline"; $int1=38; 5. Data type

1. Scalar data type

(1)Boolean type boolean

The output result is 1.

The output result is empty

(2) Shaping integer

(3) Float is also called double

(4)String string

";//The use of delimiters allows multi-line strings to maintain format echo $str."
"; echo $str2 ."
"; ?> Check variable type

";//The use of delimiters allows multi-line strings to maintain format var_dump($str)."
" ; var_dump($str2)."
"; $int1=5; var_dump($int1)."
"; $dou=123.456; var_dump($dou)."
"; ?> Variable scope global

2. Composite data type

(1)Array array

(2)Object object

3. Special data types

(1)resource

(2)NULL value NULL

This article comes from the "PHP Study Notes" blog

www.bkjia.comtruehttp: //www.bkjia.com/PHPjc/478715.htmlTechArticleOne. PHP comment methods 1. // (single-line comment) 2./**/ (multi-line comment) 3. # (mostly used in Unix SHELL) 2. You can specify the embedding method yourself. Generally, ?php....?//It is recommended to use...
Statement:
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