Lucky Lucky - 1 year ago 45
jQuery Question

Convert array to associative

I have following array using


in php results to

[0] => stdClass Object
[name] => location
[value] =>lko

[1] => stdClass Object
[name] => street_number
[value] => 425

Now I want to achieve the following format array ,How can i achieve followin using best complexity feasible


I want the perfect complexity feasible solution,

Answer Source

You can try the following

 foreach ($data as $val) {


This will convert your array into the format you needed