使用同一数组中的关联数组值
我正在尝试从同一数组中访问关联数组的键和值。如果我的数组中有 3 对。我可以在第三个 another
中使用 something
和 other
的值吗?
$gar = array("something" => "something value",
"other" => "other value",
"another" => something . other
);
这个想法是另一个人的价值将是“有价值的东西”。
这可能吗?有没有办法完成同样的事情?
I'm trying to access an associative array's key and value from within the same array. If I have 3 pairs in my array. Can I use the value of let's say the values of something
and other
within the third one another
?
$gar = array("something" => "something value",
"other" => "other value",
"another" => something . other
);
The idea is that another's value will be "something valueother value".
Is this possible? Is there a way to accomplish the same thing?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(3)
像这样怎么样
how about just something like this
我的问题也谈到了类似的问题。希望有帮助! :)
PHP - 访问同一数组中的数组元素
my question speaks about the analogous problem too. Hope that helps! :)
PHP - Accessing array element within the same array
如果您像这样在多行上使用它应该没问题:
您甚至可以将上面的序列放入循环中。
It should be fine if you use it on multiple lines like this:
You could even put the above sequence in a loop then.