数组在循环PHP中使用for循环遍历数组

时间:2018-11-28 08:56:12

标签: php arrays loops foreach

嗨,我可以在数组中使用循环吗?您可以帮我使用方法吗?

    if($oran->typeid =="235")
        {
            foreach($oran->fields as $yoran)  
                {
        $tip = "Name";
        $say = count($yoran);       
            for($i=0; $i<$say; $i++) {
        $array73 = array(
            "tip" => $tip,
            "id" => 42,
            "values" => array(
                              "1"=>array("tur"=>"$yoran->desc","tid"=>"233","val"=>$yoran->value,
                              )));  
            }
        array_push($kod,$array73);
        }}

我想要...

>  for($i=0; $i<$say; $i++) {
>                                    
>      "1"=>array("tur"=>"$yoran->desc","tid"=>"233","val"=>$yoran->value,
>     )
>     
>       }

我正在动态尝试填充多维数组并遇到一些麻烦。

https://i.ibb.co/CKCrF3X/asd.jpg

1 个答案:

答案 0 :(得分:0)

我不完全了解您的尝试, 但我相信array_map将为您提供帮助