在数组中输出并输出整个数组?

时间:2016-09-29 09:39:29

标签: php arrays

Array ( [feature class] => L 
        [feature code] => RGN 
        [country code] => ES 
        [admin1code] => 00 
        [admin2code] => CO 
        [geonameid] => 2521750 )

Array ( [feature class] => A 
        [feature code] => ADM1 
        [country code] => ES 
        [admin1code] => 51 
        [admin2code] => [geonameid] => 2593109 )

Array ( [feature class] => S 
        [feature code] => GDN 
        [country code] => ES 
        [admin1code] => 60 
        [admin2code] => A 
        [geonameid] => 10290879 )

这是我的3个print_r数组。热门检查哪个有这个:[feature code] => ADM1然后从该数组输出:[country code] => ES [admin1code] => 51

P.S

这是我的阵列。

Array ( [0] => Array ( [feature class] => L [feature code] => RGN [country code] => ES [admin1code] => 00 [admin2code] => CO [geonameid] => 2521750 ) [1] => Array ( [feature class] => A [feature code] => ADM1 [country code] => ES [admin1code] => 51 [admin2code] => [geonameid] => 2593109 ) [2] => Array ( [feature class] => S [feature code] => GDN [country code] => ES [admin1code] => 60 [admin2code] => A [geonameid] => 10290879 ) )

我做了:foreach ($array as $key => $value)

现在如何找到其中的数组:[feature code] => ADM1并输出所有数据?

1 个答案:

答案 0 :(得分:0)

让我们说3个数组的命名如下:$ arr1,$ arr2和$ arr3。将它们全部放入1个数组并循环检查:

SELECT [FieldA]
       ,DATEADD(hour,2([DateField])) AS [NewDate]
FROM [Table]