数组 switch case 语句
我有一个带有这样的子数组的数组,
Array
(
[0] => Array
(
[customers] => Array
(
[id] =>
)
[Products] => Array
(
[id] =>
)
[Models] => Array
(
[id] => 151
[SubModels] => Array
(
[ol] =>
)
[Noice] =>
)
)
我想在数组上创建一个 switch 语句
,这样
switch($array){
case Products:
case customers:
case Models:
}
我该怎么做。 谢谢
I have an array coming in with sub arrays like this
Array
(
[0] => Array
(
[customers] => Array
(
[id] =>
)
[Products] => Array
(
[id] =>
)
[Models] => Array
(
[id] => 151
[SubModels] => Array
(
[ol] =>
)
[Noice] =>
)
)
I want to make a switch statement on the array
so something like this
switch($array){
case Products:
case customers:
case Models:
}
how would I do that.
Thanks
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
由于 $array 中包含一个数组,因此看起来您实际上想要查看索引于 $array[0] 的数组的键
since $array holds an array within it, it looks like you'll actually want to look at the keys of the array indexed at $array[0]