The system summarizes the essence and skills of PHP development language. Many PHP programmers, especially those who have not been learning for a long time, do not know the essence of PHP. How did Perl become famous in the business world? Its powerful regular expression. What about PHP? He is a PHP programmer who has been studying PHP for a long time and does not know the essence of PHP. How did Perl become famous in the business world? Its powerful regular expression. What about PHP? He is a language developed from Unix. of course, he inherits many features of Perl and has advantages in C. Fast, concise, and clear. especially for C programmers, PHP is a favorite. I love PHP very much (I forgot my girlfriend ). Here, I want to write an article about PHP variables, array application skills, PHP regular expressions, and PHP template applications. I will try again later to write the full combination of PHP, COM, PHP, and XML.
1. Application techniques of variables and arrays
(1) a lot of array functions are rarely used. Foreach, list, and each. Here are a few examples. Example:
| $ Data = array ('a' => 'data1', 'B' => 'data2 ', 'C' => 'data3 ');
While (list ($ subscript, $ value) = each ($ data ))
{
Echo "$ subscript => $ value ::";
Echo "$ subscript => $ valuen
";
}
Reset ($ data );
Foreach ($ data as $ subscript => $ value)
{
Echo "$ subscript => $ value ::";
Echo "$ subscript => $ valuen
";
} |
(2) function variables, variable variables, and variable "pointers ":
| // Variable
$ Var = "this is a var ";
$ Varname = "var ";
Echo $ varname;
// Function variable
Function fun1 ($ str ){
Echo $ str;
}
$ Funname = "fun1 ";
$ Funname ("This is a function! ");
?> |
The "pointer" of the variable ". This pointer is enclosed in double quotes, indicating that it is not a real pointer. Take a look at the following example:
| Function ($ ){
$ A ++;
}
$ C = 0;
Function ($ c );
Echo $ c; // $ c is still 0
Function (& $ ){
$ A ++;
}
$ C = 0;
Echo $ c; // $ c is 1
?> |
It is called "pointer" because it has the same function as the pointer in C language. But this is not a real pointer. it can only be understood in this way.
- 2 pages in total:
- Previous Page
- 1
- 2
- Next page
Bytes. How did Perl become famous in the business world? Its powerful regular expression. What about PHP? He is a slave...