Use PHP to associate arrays. When operating the database, we need to use the following to view an array traversal in the basic numeric format :? Php $ temp [0] richmond; $ temp [1] tigers; $ temp [2] premiers; for which we need to useNext, let's look at a basic number format array traversal:
-
php
- $temp[0] = "richmond";
- $temp[1] = "tigers";
- $temp[2] = "premiers";
-
- for($x=0;$x<count($temp);$x++)
- {
- echo $temp[$x];
- echo " ";
- }
- ?>
However, another way to save code is:
-
php
- $temp = array("richmond", "tigers", "premiers");
- foreach ($temp as $element)
- echo "$element ";
- ?>
Foreach can also output text subscript:
-
php
- $temp = array("club" => "richmond",
- "nickname" =>"tigers",
- "aim" => "premiers");
-
- foreach ($temp as $key => $value)
- echo "$key : $value ";
- ?>
The above describes how to use PHP associated arrays in the database.
Then let's look at a basic number format array traversal :? Php $ temp [0] = "richmond"; $ temp [1] = "tigers"; $ temp [2] = "premiers";...