Combining Three Arrays in foreach loop in PHP

后端 未结 2 1876
梦毁少年i
梦毁少年i 2021-01-27 09:57

I know how to combine two arrays in foreach loop using array_combine() function of PHP

But I have three arrays and I want to loop through all of three array

2条回答
  •  不思量自难忘°
    2021-01-27 10:16

    Combine the arrays before the foreach loop

        $comment_array = array_combine($get_id, $get_comment);
        $product_array = array_combine($get_id, $get_product);
        foreach ($product_array as $id => $product) {
          $comment = $comment_array[$id];
        }
    

提交回复
热议问题