foreach with three variables add

后端 未结 4 1155
别跟我提以往
别跟我提以往 2020-12-04 01:12

i want to use foreach function for 3 variables

i use this code in my page:

foreach (array_combine($online_order_name, $online_order_         


        
4条回答
  •  情书的邮戳
    2020-12-04 01:53

    for ($i = 0, $length = count($array1); $i < $length; $i++) {
        list($a, $b, $c) = array($array1[$i], $array2[$i], $array3[$i]);
        ...
    }
    

    You should think about a better array structure though that doesn't require you to pull information from three different arrays. Something like:

    $orders = array(
        array('name' => 'Foo', 'q' => 'bar', 'third' => 'Baz'),
        ...
    );
    

提交回复
热议问题