0

I have question about calling array multidimensional.
I have array like this

array(1) { ["month"]=> array(2) { 
["January"]=> array(4) { [0]=> array(1) { [1]=> string(4) "2100" } [1]=> array(1) { [2]=> string(2) "50" } [2]=> array(1) { [3]=> string(4) "7858" } [3]=> array(1) { [4]=> string(4) "3535" } } 
["December"]=> array(2) { [0]=> array(1) { [1]=> string(3) "123" } [1]=> array(1) { [2]=> string(4) "1900" } } } }

if I convert to json_encode, like this:

string(111) "{"month":{"January":[{"1":"2100"},{"2":"50"},{"3":"7858"},{"4":"3535"}],"December":[{"1":"123"},{"2":"1900"}]}}" 

"month" have 2 element right? (January and December)
and January have 4 element;

question is: How to call array month with value January and December without child value in January and December?
I think like this: array (2) => {[January][December]}

2
  • array_keys($array); Commented Jan 20, 2018 at 6:06
  • thanks Nan it's works :) Commented Jan 20, 2018 at 6:41

2 Answers 2

0

Specific to your question use : array_keys($array['month']);

Sign up to request clarification or add additional context in comments.

1 Comment

thanks Prathamesh palav :) solved it
0
array_keys($array['month']);

it will solves your problem https://eval.in/938638`

1 Comment

thanks guys :) you solved it

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.