-5

i have Array ( [0] => dev2 [1] => dev3 [2] => dev4 )

how to convert to ["dev2","dev3","dev4"]

  • Do you mean you want the output to be ["dev2","dev3","dev4"] rather than Array ( [0] => dev2 [1] => dev3 [2] => dev4 ) If yes, refer to https://stackoverflow.com/questions/5618925/convert-php-array-to-javascript/12863675 – poo Sep 20 '21 at 04:44
  • They both are same. You are getting those indexes because you did print_r(); – nice_dev Sep 20 '21 at 04:54

1 Answers1

0
$old_array = array( 'dev2', 'dev3', 'dev4');
$new_array = json_encode($old_array);
echo $new_array;

I hope this is what you want.