Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/226.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/3/arrays/13.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Php 如何获取此数组中的值_Php_Arrays - Fatal编程技术网

Php 如何获取此数组中的值

Php 如何获取此数组中的值,php,arrays,Php,Arrays,在循环中,如何在一个变量中获得收入和毛利、总收入,以及在另一个变量中获得年份值 请帮我修一下 谢谢,您可以为每个循环制作2个 $result\u array\u 1将是键数组和值数组 Array ( [REVENUE AND GROSS PROFIT] => Array ( [2010] => null [2011] => null [2012] => null [2013] => nul

在循环中,如何在一个变量中获得收入和毛利、总收入,以及在另一个变量中获得年份值

请帮我修一下


谢谢,

您可以为每个循环制作2个

$result\u array\u 1
将是键数组和值数组

Array
(
   [REVENUE AND GROSS PROFIT] => Array
    (
        [2010] => null
        [2011] => null
        [2012] => null
        [2013] => null
        [2014] => null
    )

[Total revenue] => Array
    (
        [2010] => 11611.00
        [2011] => 12971.00
        [2012] => 13654.00
        [2013] => 13373.00
        [2014] => 14427.00
    )

[OPERATING EXPENSES] => Array
    (
        [2010] => null
        [2011] => null
        [2012] => null
        [2013] => null
        [2014] => null
    )
)

您希望您的输出是什么样的?请适当地澄清一下。我想像这样的东西可以帮助你。。
foreach($array as $key => $value){
  $result_array_1[] = $key;

  foreach($value as $ $val){
    $result_array_2[] = $val;
  }
}