PHP数组语法/运算符? [英] PHP array syntax/operator?

查看:156
本文介绍了PHP数组语法/运算符?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在PHP中为关联数组编写语法时,请执行以下操作

When writing the syntax for an associative array in PHP we do the following

$a = array('foo' => 'bar');

我很好奇=>语法(或可能是运算符)之间的关系.这是否与ZE哈希表中使用的某种引用有关,还是与C中使用的某种后续右移或引用有关?我想我只是想知道该语法的真正潜在目的,它与用于处理数组的ZE和/或php扩展有何关系,在编译之前它可能与C中的书面函数有什么关系,或者如果我没有知道我在说什么:)

I am curious of the relationship of the => syntax, or possibly operator. Does this relate to some kind of reference used in the hash table in ZE, or some kind of subsequent right shift or reference used in C? I guess I am just wondering the true underlying purpose of this syntax, how it relates to ZE and/or php extensions used to handle arrays, how it possibly relates to the written function in C before compiled, or If I just have no idea what I am talking about :)

推荐答案

=>符号a.k.a. T_DOUBLE_ARROW只是一个解析器令牌,例如class||::.

The => symbol a.k.a. T_DOUBLE_ARROW is just a parser token like class, || or ::.

See: The list of php parser tokens

除了"it looks like an arrow"以及用于"array stuff"的事实外,没有什么特别的.

It's nothing special apart from that fact that "it looks like an arrow" and it is used for "array stuff".

当然,确切的用法要比这复杂得多,但是 "array stuff" 是应该做的简短的不准确描述.

Of course the exact usage is more complicated than that but "array stuff" is the short inaccurate description that should do it.

它用来表示key => ( points to )value

这篇关于PHP数组语法/运算符?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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