jmu jmu - 4 months ago 25
PHP Question

how to read string in Array ([2622232] => [] => apple ) PHP

I am trying to read string in session array.

Here is the code I entered

into my session:($number is 2622232 here)


When I used
, I get the following array:

Array ( [2622232] => [] => apple )

My question is how can I get the string "apple"? My editor give me error message when I tried to use
to read string.

Any idea about my situation?


The only way to get that print_r() output is with an empty string as key [''], so you need to find where you do that and fix it. However you can access it:

echo $_SESSION['fruit'][2622232][''];