How to loop through two or more arrays in php or jq, each array has two elements, as shown below
何惜一博2018-11-16 17:20:53
0
3
1188
For example: $a = [A,B] $b = [C,D]
How to loop $array=array(
,
) ,
God help me! ! The method that is not hard-coded can be multiple arrays. The background product specifications are as follows, both js and php can be used
replyBrother, what if there are three or four groups, such as $a = [A,B] $b = [C,D] $c = [E,F]
$array=array(
array(A,C,E) ,
array(A,C,F) ,
array(A,D,E),
array(A,D,F) ,
.....
array(B,D,F)
)
The loop reaches the end, is there any way, brother?
Multiple specifications
<?php
$arr = array();
foreach($a as $key=>$value){
foreach($b as $key1=>$value1){
$arrSon[] = $value;
$arrSon[] = $value1;
$arr[] = $arrSon;
unset($arrSon);
}
}
echo "<pre/>";
print_r($arr);
?>
希望有用