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

何惜一博
何惜一博

reply all(2)
唯一

Multiple specifications

PHP

<?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);

?>

希望有用

  • reply Brother, 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?
    何惜一博 author 2018-11-16 18:03:59
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template