在数组符号PHP大括号 [英] PHP curly braces in array notation

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

问题描述

我刚刚碰到的PHP code的一个很奇怪的一点:

I'd just come across a very weird bit of php code:

$oink{'pig'} = 1;
var_dump($oink);

$oink{'pig'} = '123123';
echo $oink{'pig'}; /* => 123123 */
echo $oink['pig']; /* => 123123 */

它就像一个数组,但手册中提到无门。这是什么?

It works like an array, but nowhere mentioned in the manual. What is this?

推荐答案

第一次提及我能找到的是在手册中此评论 - <一个href=\"http://php.net/manual/language.types.array.php#99015\">http://php.net/manual/language.types.array.php#99015

First mention I can find is this comment in the manual - http://php.net/manual/language.types.array.php#99015

似乎是一个Perl的语法采纳。

Seems to be a perl-like syntax adoption.

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

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