PHP Development Web pages need to be stored in the Wamp root directory in the WWW folder to run successfully. At the same time Wamp to be in the running state.
Open without a site mode:
Enter: localhost/file name in the URL field
1 code specification:
with
<? PHP
?>
surround the code.
Syntax Specification:
1 $a=10;2 $b= "World";3 Var_dump($a);//output character type and length4 Var_dump($b);5 6 7 8 9 $a= (string)$a;//cast type of a is a stringTen //settype ($a, "string"); One Var_dump($a);
here is the result of the run
Character Stitching:
1 $name= "Zhang San";2 $s= "Hello {$name}";3 Echo $s;4 Echo"<br>";5 6 $a= "Hello";7 $a. = "Zhang San";8 Echo $a;9 //php inside stitching string with dot, without plus sign
Variable variable:
1 $a=10; 2 $b= "Dsdw"; 3 Echo $a // multiple strings can be output at the same time 4 Print $a // you can only output one 5 //print_r (); specialized print array <br><br>var_dump ($b);//output variable information
Judgment and deletion:
1 Var_dump(Empty($b));//determines whether a variable is empty, a value of 0, or a null character also displays true2 Var_dump(isset($b));//determine if a variable is defined3 4 $a= 10;5 unset($a);//Delete a variable6 Var_dump(isset($a));
Variable Address:
1 // & Represents the address of the variable 2 $a = ten; 3 $b = &$a; 4 $b = 5; 5 Echo $a; // the address of a has been changed
Determine if they are equal:
1 $a = ten;
2 $b = 8;
3 var_dump($a= =$b);
Three-mesh operators:
1 $a = ten;
2 $b = 8;
3 echo $a= =$b? " Equal ":" Not Equal ";
Error suppressor:
1 // @ ERROR Suppressor 2 //notice: Reminder (hint) 3 //warning: Warning 4 //error: Error 5 //notice: Some reminders are not real mistakes 6 7 8 echo @$a;
Branch statements:
1 $a=8;2 $b=9;3 $c=6;4 $d=35;5 6 7 if($a<10)8 {9 Echo"A less than 10";Ten } One Echo"<br>"; A if($b<10) - Echo"B less than 10"; - Echo"<br>"; the if($c<10) - { - Echo"OK"; - } + Else - { + Echo"NO"; A } at Echo"<br>"; - if($d<10) - { - Echo"A less than 10"; - } - Else if($d<20) in { - Echo"D between 10 to 20"; to } + Else - { the Echo"D is greater than 20"; *}
Switch Case statement:
1 $a=3;2 3 Switch($a)4 {5 Case1:6 Echo"1111";7 Break;8 Case2:9 Echo"22222";Ten Break; One Case3: A Echo"33333"; - Break; - default: the Echo"00000"; -}
for Loop statement:
0 to 9
1 for ($i= 0; $i<10; $i+ +)2{3 echo$i; 4 }
Logical statement:
1 && // If multiple bool type data is performed with an operation, as long as there is a false, the result is false2 3 || // if more than one bool type of data is performed or operated, as long as there is one true, the result is true 4 5 ! // logic is not equivalent to reverse
PHP operations and statements and logic