php数组 按照日期循环取值问题

已知数组arr,现在需要标题栏按照月循环,假如从17年1月至18年12月。假如数组arr中的confirm_m项和标题的月相同时,则显示数组arr中的confirm_m项对应confirm_value的值。
比如confirm_m为1804,则显示成这种形式:

1801 1802 1803 1804 1805 1806 ...

  • - - 50484 -

请问怎么写?

数组arr:
array(26) {
[0]=>
string(2) "b0"
["area2"]=>
string(2) "b0"
[1]=>
string(18) "A项目"
["project"]=>
string(18) "A项目"
[2]=>
string(2) "PE"
["department"]=>
string(2) "PE"
[3]=>
string(4) "1804"
["confirm_m"]=>
string(4) "1804"
[4]=>
string(1) " "
["confirm_m_2"]=>
string(1) " "
[5]=>
string(1) " "
["confirm_m_3"]=>
string(1) " "
[6]=>
string(1) " "
["confirm_m_4"]=>
string(1) " "
[7]=>
string(1) " "
["confirm_m_5"]=>
string(1) " "
[8]=>
float(50484)
["confirm_value"]=>
float(50484)
[9]=>
float(0)
["confirm_value_2"]=>
float(0)
[10]=>
float(0)
["confirm_value_3"]=>
float(0)
[11]=>
float(0)
["confirm_value_4"]=>
float(0)
[12]=>
float(0)
["confirm_value_5"]=>
float(0)
}

表示学了php一个月,只用一些基本的原生代码做的,不知道符不符合你要求
<?php
header("content-type:text/html;charset=utf-8");
$arr=array(
0=> "b0",
"area2"=> "b0",
1=>"A项目",
"project"=>"A项目",
2=>"PE",
"department"=>"PE",
3=>"1804",
"confirm_m_1"=> "1804",
4=> " ",
"confirm_m_2"=> " ",
5=>" ",
"confirm_m_3"=> " ",
6=> " ",
"confirm_m_4"=> " ",
7=>"",
"confirm_m_5"=>" ",
8=>50484,
"confirm_value_1"=>50484,
9=>0,
"confirm_value_2"=>0,
10=>0,
"confirm_value_3"=>0,
11=>0,
"confirm_value_4"=>0,
12=>0,
"confirm_value_5"=>0
);
$data=array('1803','1804','1805','1806');
foreach($data as $val){
echo $val;
echo "    ";
}
echo "
";
foreach($data as $value){
foreach($arr as $key=>$val){
if(!is_int($key)){
if($val==$value){
$a=substr($key,10)?substr($key,10):'';
foreach($arr as $k=>$v){
if(substr($k,14)==$a){
echo $v;
echo "    ";
continue 3;
}

}

    }

}

}
echo "-";
echo "    ";
}
我把日期放进一个数组当中去了,同时将你数组当中的['confirm_m']和['confirm_value']改成了['confirm_m_1']和['confirm_value__1']