php - 取消数组中键的范围

标签 php arrays key unset

如何在这样的数组中取消设置介于 70 到 80 之间的键范围?

[63] => Computer Science and Informatics
[64] => Dentistry
[65] => Development Studies
[66] => Drama, Dance and Performing Arts
[67] => Earth Systems and Environmental Sciences
[68] => Economics and Econometrics
[69] => Education
[70] => Electrical and Electronic Engineering
[71] => English Language and Literature
[72] => Epidemiology and Public Health
[73] => European Studies
[74] => French
[75] => General Engineering and Mineral & Mining Engineering
[76] => Geography and Environmental Studies
[77] => Geography and Environmental Studies
[78] => German, Dutch and Scandinavian Languages
[79] => Health Services Research
[80] => History
[81] => History of Art, Architecture and Design
[82] => Iberian and Latin American Languages
[83] => Infection and Immunology
[84] => Italian
[85] => Law
[86] => Library and Information Management
[87] => Linguistics
[88] => Mechanical, Aeronautical and Manufacturing Engineering
[89] => Metallurgy and Materials
[90] => Middle Eastern and African Studies

最佳答案

这并没有捷径:

for ($i = 70; $i <= 80; $i++)  
    unset($array[$i]);

关于php - 取消数组中键的范围,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/2352926/

相关文章:

PHP 更改日期格式(日期来自 MySQL 的 'CURRENT_TIMESTAMP'

php - 为什么 PHP str_replace 在我的服务器上不匹配某个字符串

PHP 不会在 mysql 上更新 +1 值

arrays - Swift 4 按值复制内部有数组的对象数组

c# - 在 .NET 中,Dictionary<string,TValue> 是否存在键冲突

google-app-engine - GWT:解密 GAE-JDO key 以访问父级

json - 如何在 jq 中传播对象的属性?

php - MySQL数据类型的用途

python:迭代并行嵌套列表中的每个项目

php - 使用简单的 html dom 获取 url-data 属性