PHP多维数组 [英] PHP multidimensional array

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

问题描述

下面是利弊匆匆:

如何显示值1,2,3等,因为它是在它的第三排?

  $ meta_boxes =阵列  (
        复选框=>排列
        (
              名= GT; 复选框
              标题=> ,
              说明=> 这是一个复选框字段的一个例子。
              类型=> 复选框
              行=> ,
              宽度=> ,
              选项=>排列
              (
                    1=> 值1,
                    2=> 值2,
                    3=> 值3
              )
  )


解决方案

$ meta_boxes ['复选框'] ['选项'] ['1'] 会给你字符串值1从数组,然后你可以做任何你想要与价值。

您现在应该能够找出如何访问其他两个。

Here's a quickie for the pros:

How do I display Value 1, 2, 3 etc as it's in it's third array?

$meta_boxes = array

  (
        "checkbox" => array
        (
              "name" => "checkbox",
              "title" => "",
              "description" => "This is an example of a checkbox field.",
              "type" => "checkbox",
              "rows" => "",
              "width" => "",
              "options" => array
              (
                    "1" => "Value 1",
                    "2" => "Value 2",
                    "3" => "Value 3"
              )
  ),

解决方案

$meta_boxes['checkbox']['options']['1'] will give you the string "Value 1" from the array, and then you can do whatever you want with that value.

You should now be able to figure out how to access the other two.

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

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