Php foreach loop wrapping every 2 items

后端 未结 6 1356
梦谈多话
梦谈多话 2021-02-06 08:03
query(a
6条回答
  •  情话喂你
    2021-02-06 08:43

    # Process every second item starting with the first one [0].
    foreach ($array as $key => $value) {
        if (($key - 1) % 2 === 0) {
            continue;
        }
    
        # Do something here.
    
    }
    

提交回复
热议问题