PHP two-dimensional array and three-dimensional array filter, PHP two-dimensional array of arrays
Not much nonsense to say, directly to everyone to paste the code, the specific code is as follows:
<?php$arr = [[,,,,],[,,,,]]; $arr = [' list ' = = [[,,,],[,,,],[,,,],]; $arr = [' list ' = = [[,,,],[,,,],[,,,]]; $res = Array_map (function ($arr) {return array_filter ($arr, function ($v) {return $v!==;}), $arr); $res = Array_map (function ( $val) {return array_filter ($val, function ($v) {return!in_array (, $v);});}, $arr); $res = [];array_walk ($arr, function ($ Val, $key) use (& $res) {$res [$key] = Array_filter ($val, function ($v) {return!in_array (, $v);});}); Var_dump ($res); Var_dump ($res);
Here is a piece of code to introduce PHP three-dimensional array variable two-dimensional array
<?php$result = Array (0 = = Array (0 = = Array (bid + 41,brealname = ' We instructor ', cid = 41,crealname = ' We instructors '), 1 = = Array (0 = = Array (bid + 6,brealname = ' no ', cid = 19,crealname = ' Zhang Fish ')));//original array print_r ($result ); echo "
";///First method: foreach ($result as $key + $v) {$new _arr[]= $v [0];} Echo ';p Rint_r ($new _arr);//The second method//Initialize $ARR2 $arr 2=array ();//Loop through a three-dimensional array $arr3 foreach ($result as $value) {foreach ($value as $v) {$arr 2[]= $v;}} Destruction of $arr3 unset ($result, $value, $v); echo "
"; echo "the second method:"; Echo ' ;p Rint_ R ($arr 2);?
About PHP two-dimensional array and three-dimensional array of filtering small series to introduce you so much, I hope you have some help!
!--endmain--> articles you might be interested in:
- rewrite function to implement PHP two-dimensional/three-dimensional array to string
http://www.bkjia.com/phpjc/1111350.html www.bkjia.com true http://www.bkjia.com/phpjc/1111350.html techarticle php two-dimensional array and three-dimensional array of filtering, PHP two-dimensional array of arrays of nonsense to say, directly to everyone to paste the code, the specific code is as follows: php$ arr = [[,,,,],[,,,,]]; $arr = [' L ...