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
$dou=123.456; echo $dou; ?> (4)String string
$str="Welcome To BeiJing";//More than one word uses double quotes $str2='prometheus';//Only one word uses single quotes $k=<<
"; echo $str2 ."
"; ?> Check variable type
$str="Welcome To BeiJing";//More than one word uses double quotes $str2='prometheus';//Only one word uses single quotes $k=<<
" ; var_dump($str2)."
"; $int1=5; var_dump($int1)."
"; $dou=123.456; var_dump($dou)."
"; ?> Variable scope global
$a=10; $b=20; function test() { global $a,$b; /*Defining $a and $b as global variables can be used in function TEST. If global variables are not defined, they will will output 0*/ echo $a+$b; } echo test(); ?> 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