0

if i solve this i will have my desired result for any expert this will take few minutes to guess and i am stuck in this from last 2 hours searching and googling but couldn't found the one i want. Okay so here is the thing ...

I am sending data through ajax to my php by doing JSON.stringify and receving that that to my php in the form of this

{"0":["BE","test","test","1993"],"1":["HSSC","test","test","1995"]}

All i want to do is to get the values and insert them to the separate variables.

Rohit Poonia
  • 77
  • 1
  • 7

1 Answers1

1

You need to use json_decode to convert the string to array. You can pass the second parameter to this method to convert this to array instead of object. Then you can retrieve the data like

$string = '{"0":["BE","test","test","1993"],"1":["HSSC","test","test","1995"]}';
$array = json_decode($string, true);
print_r($array[0][0]);

Here's the example of it https://repl.it/HhI8/1

Agam Banga
  • 2,708
  • 1
  • 11
  • 18