How can i take an array, divide it by two and create two lists?

前端 未结 9 1905
暗喜
暗喜 2020-12-01 10:26

Say i have an array

$array

Could anyone give me an example of how to use a foreach loop and print two lists after the initial array total

9条回答
  •  不知归路
    2020-12-01 10:59

    http://php.net/manual/en/function.array-slice.php

    To slice the array into half, use floor(count($array)/2) to know your offset.

提交回复
热议问题