In PHP development, there is a large proportion. we are operating on arrays, so the learning of arrays is critical ~~ In PHP development, there is a large proportion. we are operating on arrays, so the learning of arrays is critical ~~
"Iwanghang", "age" => 18, "sex" => "male", "email" => "iwanghang@qq.com "), // $ group [0] array ("name" => "queen", "age" => 14, "sex" => "female ", "email" => "queen@qq.com"), // $ group [1] array ("name" => "king", "age" => 55, "sex" => "male", "email" => "king@qq.com "), // $ group [2] "four" => array ("name" => "xiaoming", "age" => 8, "sex" => "male ", "email" => "xiaoming@qq.com"); var_dump ($ group [1]); // print the result: array (4) {["name"] => string (5) "queen" ["age"] => int (14) // ["sex"] => string (3) "Female" ["email"] => string (12) "queen@qq.com"} echo"
"; Var_dump ($ group [1] [" name "]); // print the result: string (5)" queen "echo"
"; Var_dump ($ group [2] [" age "]); // print the result: int (55) echo"
"; Var_dump ($ group [" four "] [" email "]); // print the result: string (15)" xiaoming@qq.com "echo"
";
[["Name" => "iwanghang", "age" => 18, "sex" => "male", "email" => "iwanghang@qq.com"], // $ group [0] ["name" => "queen", "age" => 14, "sex" => "female ", "email" => "queen@qq.com"], // $ group [1] ["name" => "king", "age" => 55, "sex" => "male", "email" => "king@qq.com"], // $ group [2], [["name" => "iwanghang ", "age" => 18, "sex" => "male", "email" => "iwanghang@qq.com"], // $ group [0] ["name" => "queen", "age" => 14, "sex" => "female ", "email" => "queen@qq.com"], // $ group [1] ["name" => "king", "age" => 55, "sex" => "male", "email" => "king@qq.com"], // $ group [2], [["name" => "iwanghang ", "age" => 18, "sex" => "male", "email" => "iwanghang@qq.com"], // $ group [0] ["name" => "queen", "age" => 14, "sex" => "female ", "email" => "queen@qq.com"], // $ group [1] ["name" => "king", "age" => 55, "sex" => "male", "email" => "king@qq.com"], // $ group [2]; echo''; Echo' ---------- $ class ----------
'; Print_r ($ class); echo' ---------- $ class [0] ----------
'; Print_r ($ class [0]); echo' ---------- $ class [0] [0] ----------
'; Print_r ($ class [0] [0]); echo' ---------- $ class [0] [0] [\ 'name \ '] ----------
'; Print_r ($ class [0] [0] ['name']); echo'
----------- $ Class ["group1"] [0] [\ 'name \ ']) ---------
'; Print_r ($ class ["group1"] [0] ['name']);/*** print the result: ---------- $ class ---------- Array ([group1] => Array ([0] => Array ([name] => iwanghang [age] => 18 [sex] => male [email] => iwanghang@qq.com) [1] => Array ([name] => queen [age] => 14 [sex] => Female [email] => queen@qq.com) [2] => Array ([name] => king [age] => 55 [sex] => male [email] => king@qq.com )) [0] => Array ([0] => Array ([name] => iwanghang [age] => 18 [sex] => male [email] => iwanghang@qq.com) [1] => Array ([name] => queen [age] => 14 [sex] => Female [email] => queen@qq.com) [2] => Array ([name] => king [age] => 55 [sex] => male [email] => king@qq.com )) [1] => Array ([0] => Array ([name] => iwanghang [age] => 18 [sex] => male [email] => iwanghang@qq.com) [1] => Array ([name] => queen [age] => 14 [sex] => Female [email] => queen@qq.com) [2] => Array ([name] => king [age] => 55 [sex] => male [email] => king@qq.com ))) ---------- $ class [0] ---------- Array ([0] => Array ([name] => iwanghang [age] => 18 [sex] => male [email] => iwanghang@qq.com) [1] => Array ([name] => queen [age] => 14 [sex] => Female [email] => queen@qq.com) [2] => Array ([name] => king [age] => 55 [sex] => male [email] => king@qq.com )) ---------- $ class [0] [0] ---------- Array ([name] => iwanghang [age] => 18 [sex] => male [email] => iwanghang@qq.com) ---------- $ class [0] [0] ['name'] ---------- iwanghang ----------- $ class ["group1"] [0] ['name']) ----------- iwanghang */
'; $ Arr = ["one", "two", "three", "four"]; echo' ---------- isset ($ arr [2]) ----------
'; If (isset ($ arr [2]) {// print the result: echo "exists";} else {echo "doesn't exist";} echo"
"; Echo '---------- print_r ($ arr )----------
'; Print_r ($ arr); // print the result: Array ([0] => one [1] => two [2] => three [3] => four) echo"
"; Echo '---------- unset ($ arr [2]) ----------
'; Unset ($ arr [2]); if (isset ($ arr [2]) {// print the result: echo "exists ";} else {echo "does not exist";} echo"
"; Echo '---------- print_r ($ arr )----------
'; Print_r ($ arr); // print the result: Array ([0] => one [1] => two [3] => four) echo"
"; Echo '---------- $ arr [2] = null ----------
'; $ Arr [2] = null; if (isset ($ arr [2]) {// print the result: echo "exists ";} else {echo "does not exist";} echo"
"; Echo '---------- print_r ($ arr )----------
'; Print_r ($ arr); // print the result: Array ([0] => one [1] => two [3] => four [2] =>) echo"
";
1) {if ($ I % $ n = 0) {echo $ I. "divided ". $ n. "The remainder is 0, so delete ". $ arr [$ I]."
"; Unset ($ arr [$ I]);} else {$ arr [] = $ arr [$ I]; print_r ($ arr); echo"
"; Unset ($ arr [$ I]);} $ I ++;} print_r ($ arr );}
The above is the PHP development (20)-array (2) multi-dimensional array and practical application-PhpStorm content for Android programmers. For more information, see PHP Chinese network (www.php1.cn )!