This article is published by the North Song Kang
------The PHP language is similar to the way JavaScript is used
<script type= "Text/javascript" >
</script>--js with PHP is a weakly typed language weakly typed language just does not display the performance definition variable when the system automatically gives default
So you can define variables when you define PHP variables.
1:
---------common statements in PHP:
$a = 10; Based on the value written, the system automatically becomes an int
$b = "Hello"; define a string;
$c = ' Hello '; ibid.
$d = "www{$a}www" inserts other characters into the character
-----"" and "difference"
The escape character can be parsed in double quotation marks, not single quotation mark
Double quotation mark inside can parse variable, single quotation mark not
$e =<<<xxx
XXX;
$f
----Output:
echo $a output statement
Var_dump ($a); the output statement used to test the code
More commonly used
-------Use of PHP
<?php
?>
<?
?>
----OUTPUT statement:
echo "Hello", "world"; can have more than one character at the same time there are more common
print "world"; not commonly used
Print_r (); Output array Information
Var_dump ();//Variables and types
------Common variable types in PHP in theory
int, float, double, bool, char, string
-----There are many similarities to the similarity of C # in PHP in the use of statements
---branch statements
1,if--else
2,if---else if----
3, if (nested)
Course Courseware Script:
<body><?php//Comment/* Multiline comment *///output statement//echo "Hello", "Helloa";//print "World";//print_r (); Output array information//var_dump ();//variable and type//variable definition//int float bool string//weakly typed language/* $a = ten; $b = "he{$a}llo"; $c = ' world '; $d = <<<aahello "AA", "BB", ' cc ', <input type= "text" value= "AA"/>AA;*///1. Double quotes inside can parse escape character, single quotation mark does not Line//2. Double quotes inside can parse variable, single quotation mark does not//$e = $a. $c; The concatenation string is with a.//$f = 10.05;//$f = (string) $f; Type conversion//$f = "Hello";//$aa = "CC";//$cc = "DD";//echo $ $aa; Variable variable//$DD = & $aa; & Fetch address//$DD = "ee";//echo $aa;//operator and expression $ A = ten; $b = 4;//echo $a/$b;//echo @ $c; The error suppressor does not suppress all errors//echo $a = = $b? " OK ":" No "; Trinocular operator/*if ($a = = $b) {echo "OK";} Else{echo "No";} */
Syntax//1.if...else...//2.if...else if...//3.if nested/* $a = 2;switch ($a) {case 1:echo "11111"; break;case 2:echo "222222"; Case 3:echo "333333"; Break;default:echo "444"; *///1.for/*for ($i =0; $i <10; $i + +) {echo $i. " <br> ";} *///2.while//3.do...while//echo $e;//var_dump ($f);? ><script type= "Text/javascript" ></script></body>
The North song well-off Kang in 2016-06-01/20:32:44 released
PHP Learning Notes---basic syntax