Accessing data in a php multi-dimensional array -
i have multi-dimensional array , php seems returning array instead of value when attempt access values directly. doing cause this?
the array looks (via print_r):
array ( [12] => array ( [2016] => 93083.00 [2015] => 85367.00 [2014] => 69726.00 ) [11] => array ( [2016] => 66730.00 [2015] => 65548.00 [2014] => 77936.00 ) [10] => array ( [2016] => 84602.00 [2015] => 112070.00 [2014] => 102104.00 ) )
i'm trying access values using $arrayname[12][2016]
returning array[2016]
instead of 93083
.
is simple syntax mistake? or missing part of concept here? i've been trying work problem hours maybe i'm missing simple explanation.
edit: syntax above correct, issue in data entry: trying access key didn't exist. tried delete post, can't since has been answered.
$arrayname[12] = [2016=>93083.00, 2015=> 85367.00 ] ... ... echo $arrayname[12][2015] ; // prints 85367
i think array has 1 more level. try $arrayname[12][2016][2016] .
Comments
Post a Comment