jmu jmu - 1 year ago 57
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?

Answer Source

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][''];
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download