English 中文(简体)
仅以名称显示1个阵列的内容
原标题:Only show content of 1 array by it s name
  • 时间:2011-11-23 14:46:08
  •  标签:
  • php
  • arrays

如果有,也存在这样的情况:

Array ( 
[Example1] => Array 
    ( 
        [0] => [1] => [2] => [3] => [4] => [5] => [6] => [7] => [8] => [9] => 
    ) 
[Example2] => Array 
    ( 
        [0] => [1] => [2] => [3] => [4] => 
        [5] => [6] => [7] => [8] => [9] => 
        [10] => [11] => [12] => [13] => [14] => 
        [15] => [16] => [17] => [18] => [19] => 
        [20] => [21] => [22] => [23] => [24] => 
        [25] => [26] => [27] => [28] => [29] => 
        [30] => [31] => [32] => [33] => [34] => 
        [35] => [36] => [37] => [38] => [39] => 
        [40] => [41] => [42] => [43] => [44] => 
        [45] => [46] => [47] => [48] => [49] => 
        [50] => [51] => [52] => [53] => [54] => 
        [55] => [56] => [57] => [58] => [59] => 
        [60] => [61] => [62] => [63] => [64] => 
        [65] => [66] => [67] => [68] => [69] => 
        [70] => [71] => [72] => [73] => [74] => 
        [75] => [76] => [77] => [78] => [79] => 
        [80] => [81] => [82] => [83] => [84] => 
        [85] => [86] => [87] => [88] => [89] => 
        [90] => [91] => [92] => [93] => [94] => 
        [95] => [96] => [97] => [98] => [99] => 
        [100] => [101] => [102] => [103] => [104] => 
        [105] => [106] => [107] => [108] => [109] => 
        [110] => [111] => [112] => [113] => [114] => 
        [115] => [116] => [117] => [118] => [119] => 
        [120] => [121] => [122] => [123] => [124] => 
        [125] => [126] => [127] => [128] => [129] => 
        [130] => [131] => [132] => [133] => [134] => 
    ) 
)

现有2个主要阵列(Example1 & Example2),在这些阵列中还有1个。 我愿知道,我只能说一阵像“Example2”这样一阵,这样它就只印成一纸,忽视了“Example1”

请注意,可能有两个以上的主要阵列。

如果用这一阵列的话,我想要缩小菜单,这里我有:

$__selectGroups =   ;
    foreach ($groups as $key => $options)
    {
        sort($options);
        if ($key !==   )
        {
            $__selectGroups .=  <optgroup label=" .$key. "> ;
        }
        $__selectGroups .= implode("
", $options);
        if ($key !==   )
        {
            $__selectGroups .=  </optgroup> ;
        }
    }

我怎么能够告诉我们,只用实例2来缩小这一差距,而忽视其他现象?

最佳回答

我不相信我理解这个问题......似乎太简单:

print_r($yourArray[ Example1 ]);

既然你编辑了你的问题,我认为你想这样做?

foreach ($yourArray[ Example1 ] as $key => $value) {
}

进入封顶阵列的这种模式在总体上适用......

问题回答

你们需要这样的东西:

echo  <pre> ;
print_r($yourArray[ Example1 ]);
print_r($yourArray[ Example2 ]);
echo  <pre> ;

或者,你们需要更详细的内容?





相关问题
Brute-force/DoS prevention in PHP [closed]

I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

定值美元

如何确认来自正确来源的数字。

Generating a drop down list of timezones with PHP

Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need ...

Text as watermarking in PHP

I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...

How does php cast boolean variables?

How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...

热门标签