我如何在 php 数组中传递一个空键

发布于 2024-09-18 16:13:26 字数 225 浏览 3 评论 0原文

如果没有这样的键,我如何获取数组内容,

$products[0] 

这将使我部分到达那里,但我如何过去[]

( [0] => Array 
( [] => Array ( 
[0] => Array ( [product_name] => stuff i need to get to  ) 

how to i get to the arrays content if it doesnt have a key like this

$products[0] 

this will get me partially there but how to i get past []

( [0] => Array 
( [] => Array ( 
[0] => Array ( [product_name] => stuff i need to get to  ) 

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

我做我的改变 2024-09-25 16:13:26

这很奇怪。你可以尝试

$products[0][''][0]['product_name']

That is very strange. You could try

$products[0][''][0]['product_name']
话少情深 2024-09-25 16:13:26

使用 var_dump 或 var_export 打印数组,您将看到它是一个空字符串。
print_r 将为您提供与空字符串类似的输出。

Use var_dump or var_export to print your array and you will see its an empty string.
print_r will give you output like that for empty strings.

决绝 2024-09-25 16:13:26
$products[0][""][0]["product_name"]
$products[0][""][0]["product_name"]
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文