I spent an hour reviewing php that I haven't touched for many years. mark, I learned it during my sophomore year. 1. the code is embedded in & lt ;? Php? & Gt; 2. output function echo, equivalent to document. write3. in js, you can use single quotation marks when printing double quotation marks or single quotation marks when printing double quotation marks. Echo & amp;... "/> <scripttype =" text/j
I spent an hour reviewing php that I haven't touched for many years. mark, I learned it during my sophomore year.
1. the code is embedded in Internal
2. the output function echo is equivalent to document. write in js.
3. you can use single quotation marks when printing double quotation marks or single quotation marks when printing double quotation marks.
Echo 'She said, "how you are? "';
Echo "she said, 'How you are? '";
4. you can use \, echo 'I \'m just ducky.'; echo "she said, \" How are you? \"";
5. shell style is recommended for comments. # this is a comment
6. variables are the same as those in c, with $.
Echo $ money;
Echo "hello, $ money ";
7. connection string $ aa = "sdfs"; $ bb = "fsdfs"; $ cc = $ aa. $ bb;
$ Cc = $ cc. "fsdfs ";
8. about numbers
$ N = 2.13;
$ N = round ($ n); // 3 Rounding
$ N = 3.13141;
$ N = round ($ n, 3); // rounding of the reserved digits 3.131
$ N = number_format ($ n); // add a separator
$ N = number_format ($ n, 4); // you can specify the number of digits.
9. constants
Define ('name', 'value ');
Echo NAME;
10. get is used to initiate data requests. post users send data in one way.
11. $ _ REQUEST is a set of super global variables, including $ _ POST and $ _ GET.
12. the isset () function is used to determine whether a variable has a value.
13. the empty () function is used to determine whether a variable is null.
14. check whether the is_numeric function is used as a number.
15. array
$ Band [] = "sdfs ";
$ Band [] = "sdfs ";
$ Band [] = "huhu ";
$ State = array (key1 => value1, key2 => value2 .......);
The key value corresponds to echo $ state [key1];
Foreach ($ array as $ key => $ value ){
}
Two-dimensional array
$ Array2 = (key1 => array1 ,.......);
16. sort
Sort sorts by value and resets the relationship between values.
Asort is sorted by value to maintain the key-value relationship.
Ksort sort by key
Rsort, arsort, and krsort reverse sorting
17. circular judgment
18. include files
Include (url );
Require (url); // can contain multiple times
Include_once (url );
Require (url); // can only contain once
19. process html forms
If ($ isset ($ _ POST ['submitted']) {
}
Else {
}
20. $ page_title set the title
21. set a sticky form
22. for functions, refer to js functions.
Note that an array can be returned.
For example, return array ($ avariable1, $ avariable2 );
You can set the default parameters.
Function greet ($ name, $ msg = "hello "){
}
23. to enable external use of variables in a function, global
Function xxx (){
Global $ fsdf;
}