在PHP数组的负折射率 [英] Negative index of array in PHP

查看:102
本文介绍了在PHP数组的负折射率的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我发现,使用负数组的索引一些code。然后,我尝试使用它,什么都不会发生。它通常行为。我可以用一个标准检索所有元素的foreach 循环。

I found some code that uses negative array indices. Then, I try to use it, nothing special happens. It behaves normally. I can retrieve all elements by using a standard foreach loop.

那么,什么是使用那些消极的指数的目的是什么?我什么时候应该使用它?

So, what is the purpose to use those negative indices? And when should I use it?

推荐答案

这是数组,在PHP,实际上只是某种有序地图:你可以用整数的(正或负)的,而且字符串,如钥匙 - 而不会有太大区别

An array, in PHP, is actually just some kind of an ordered map : you can use integers (positive or negative), but also strings, as keys -- and there will not be much of difference.

这篇关于在PHP数组的负折射率的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆