Let's take a brief introduction to the grammar of PHP.
1, embedding method:
Similar to ASP <%, PHP can be PHP or , End symbols?>, Of course you can specify yourself.
2, reference file:
There are two ways to reference files: Require and Include. The method of use of Requires such as Require ("MyRequirefile.php"); This function is usually placed in the forefront of the PHP program, and the PHP program will read the files introduced by Require before execution, so that it becomes a part of the PHP program page. Commonly used functions, or this method can introduce it into a web page. Include use method such as include ("Myincludefile.php"); This function is typically placed in the processing section of the process control. The PHP program page reads in when reading the file. This way, the process can be simplified when the program is executed.
3, annotation method:
php echo "This is the first example ./N"; // This example is a C syntax notes / * This example is a multi-line annotation method * / echo "This is the second example ./n"; Echo "This is the third example ./n"; # This example uses UNIX shell syntax notes?>
4, variable type:
$ mystring = "I am string"; $ newline = "wrap / n"; $ INT1 = 38; $ float1 = 1.732; $ float2 = 1.4e 2; $ myArray1 = array ("子", "ugly" , "", "");
Here, two problems, first, PHP variables are starting, the second PHP statement; the end, maybe ASP programmer will not be adapted. These two omissions are also most errors in the program.
5, operation symbol:
Mathematical operation: symbolic meaning addition operation - subtraction operation * Multiplication / division operation% Take the amount accumulation - decrement
String operation:
The operation symbol is only one, that is, the English number. It can connect a string to a merged string. Similar to ASP & <$ a = "PHP 4"; $ b = "powerful"; Echo $ a. $ B;?> Here is two problems, first of all PHP output statements are echo, second similar <% = Variable%>, PHP can also be = Variable?>.
Logic operation: symbolic meaning
Today, I said this, I said the process control tomorrow.