“直接访问"不引用返回值 [英] "Directly accessing" return values without referencing

查看:42
本文介绍了“直接访问"不引用返回值的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

看看这个 ruby​​ 示例:

Look at this ruby example:

puts ["Dog","Cat","Gates"][1]

这将输出 Cat 因为 ruby​​ 允许我直接访问创建的匿名"数组.

This will output Cat as ruby allows me to directly access the "anonymous" array created.

如果我在 PHP 中尝试这个,但是:

If I try this in PHP, however:

echo array("Dog","Cat,"Gates")[1]

这行不通.

  • 这叫什么,不仅涉及数组,还涉及所有函数?
  • 还有什么可能?

当您知道如何调用此功能"时,可以随意更改问题标题.

Feel free to change the question title when you know how this "feature" is called.

推荐答案

PHP 没有这样的语言结构.建议用于 PHP 6,但遭到拒绝.

PHP has no such language construct. It was proposed for PHP 6 but got declined.

这篇关于“直接访问"不引用返回值的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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