array (size=3) 0 => array (size=3) 0 => array (size=3) 'welfareName' => string '包吃住' (length=9) 'welfareIco' => string 'url_1' (length=5) 'xyId' => int 1 1 => array (size=3) 'welfareName' => string '头等舱' (length=9) 'welfareIco' => string 'url_2' (length=5) 'xyId' => int 1 2 => array (size=3) 'welfareName' => string '有车' (length=6) 'welfareIco' => string 'url_4' (length=5) 'xyId' => int 1 1 => array (size=2) 0 => array (size=3) 'welfareName' => string '头等舱' (length=9) 'welfareIco' => string 'url_2' (length=5) 'xyId' => int 2 1 => array (size=3) 'welfareName' => string '买买买' (length=9) 'welfareIco' => string 'url_3' (length=5) 'xyId' => int 2 ---------------------------------------------------------array (size=3) 0 => array (size=11) 'xyId' => int 1 'xyLocation' => string '首尔' (length=6) 'commentNum' => int 3 'visitorNum' => int 1 1 => array (size=11) 'xyId' => int 2 'xyLocation' => string '东京' (length=6) 'commentNum' => int 0 'visitorNum' => int 1--------------------------------------------------------------------------------array (size=3) 0 => array (size=11) 'xyId' => int 1 'xyLocation' => string '首尔' (length=6) 'commentNum' => int 3 'visitorNum' => int 1 'welfare' => array (size=3) 0 => array (size=3) 'welfareName' => string '包吃住' (length=9) 'welfareIco' => string 'url_1' (length=5) 'xyId' => int 1 1 => array (size=3) 'welfareName' => string '头等舱' (length=9) 'welfareIco' => string 'url_2' (length=5) 'xyId' => int 1 2 => array (size=3) 'welfareName' => string '有车' (length=6) 'welfareIco' => string 'url_4' (length=5) 'xyId' => int 1 1 => array (size=11) 'xyId' => int 2 'xyLocation' => string '东京' (length=6) 'commentNum' => int 0 'visitorNum' => int 1 'welfare' => array (size=2) 0 => array (size=3) 'welfareName' => string '头等舱' (length=9) 'welfareIco' => string 'url_2' (length=5) 'xyId' => int 2 1 => array (size=3) 'welfareName' => string '买买买' (length=9) 'welfareIco' => string 'url_3' (length=5) 'xyId' => int 2
2 番目の配列のキーに対応する値として最初の配列を使用するのと同じです
3 番目の配列を実装する方法を教えてください。教えてもらいました
for($i=0; $i<count($数组2); $i++) { $数组3[$i] = $数组2; $数组3[$i]['welfare'] = @$数组1[$i];}
モデレーターの提案も実装できますが、冗長な配列がたくさんあります、ありがとうございます
。