[PHP] PHP first day note:
Several methods for receiving parameters in PHP
PHP5 is required to receive parameters by default.
$ _ GET ['value'];
$ _ POST ['value'];
In the PHP. ini file
Set register_globals = Off
Change register_globals = on
Can be used directly, $ value
========================================================== ===
While (list ($ name, $ value) = each ($ HTTP_POST_VARS )){
Echo "$ name = $ value
\ N ";
Each () is often used in combination with list () to traverse arrays. for example:
|
Example 2. use each () to traverse the array
$ Fruit = array ('a' => 'apple', 'B' => 'bana', 'C' => 'Cranberry ');
Reset ($ fruit );
While (list ($ key, $ val) = each ($ fruit )){
Echo "$ key => $ val \ n ";
}
/* Outputs:
A => apple
B => banana
C => cranberry
*/
?> |
|
After executing each (), the array pointer will stay in the next unit of the array or stay in the last unit when it comes to the end of the array. If you want to use each to traverse the array, you must use reset ().
========================================================== ===
PHP100 Chinese network: http://www.php100.com/
PHP10 day through video tutorial: http://www.php100.com/html/phpnews/PHPxinwen/2009/0408/14.html