Php foreach loop wrapping every 2 items

后端 未结 6 1357
梦谈多话
梦谈多话 2021-02-06 08:03
query(a
6条回答
  •  花落未央
    2021-02-06 08:32

    you're almost there:

        //Build custom items 
        echo "";
        $i = 0;
        foreach($children as $child) { 
    
            echo "item "; 
    
            $i++;  
            if ($i % 2 == 0 && $i != count($children)) { 
                echo "";
            }
    
        }
        echo ""
    

提交回复
热议问题