我爱占星网 我爱占星网
首页
编程
java
php
前端
首页 编程 java php 前端

迭代循环遍历数组的每个第n个元素并删除它?

Hi i want to delete every nth element of an array iteratively. For example if I have an array like this

$input = array (1, 2, 3, 4, 5, 6, 7, 8);

and say I need to remove every 4th element. In the first iteration 5 will be removed, then 1, then 6, then 3 then 2, then 4, then 8

The number 7 will be left in the array, I want to return that !

Thanks for your help

近期文章

  • 计算php中的列数
  • 在laravel 4中找不到“图像”类
  • 删除.html扩展并使用NGINX和wp超级缓存在Wordpress中重定向它们
  • 加入查询与篝火(codeigniter)
  • 谷歌验证码nocaptcha以HTML格式
  • 从会话中获取用户数据
  • Php解析从文本文件中提取数据
  • 在mouseout上隐藏子菜单
  • wordpress用户角色的额外功能
  • cakephp2无法显示来自contains的数据
  • 在Parallels Ubuntu上升级PHP版本
  • 如何从文本输入进行谷歌搜索
  • PHP元素在元素之前和元素之后
  • php升级到5.4(动态下拉列表不起作用)
  • Wordpress if(post_name === nameOfPost)无效
  • 如何使用simplehtmldom将凭据传递到`file_get_html`
  • MySQL - 加法,减法和计算天数
  • 从Symfony2中的路由访问locale变量
  • 按用户位置更改语言和货币
  • PHP - PDF矩形CTM转换

Copyright ©2022 我爱占星 All Rights Reserved.

浙ICP备2022030071号-1

部分图文来自网络,如有侵犯您的版权,请告诉我们删除

友情链接:代码精华