Jayesh KR Jayesh KR - 6 months ago 24
PHP Question

How to convert an associative array into a simple array in php?

I have this:

array(2) { [0]=> string(3) "NBA" [1]=> string(7) "MGNREGS" }

I need it as

Can anyone help me with this.

Thanks in advance.


For which purpose do you need the array?

If you want to use JSON data, just try to call json_encode on the array:

$array = array('NBA', 'MGNREGS');
print json_encode($array);


array(2) { 
  [0]=> string(3) "NBA"
  [1]=> string(7) "MGNREGS"