javascript - How to Convert string array into simple array? -


i know that, question asked many times, different case.

i have tried many ways, doesn't found workaround.

$array = ["9","8","7","6","5"]; //javascript json.stringify() output  json_decode($array); //expects parameter 1 string, array given explode(',', $array); // array ( [0] => ["7" [1] => "6"] )  

i had tried array_shift(),array_walk(), map() still no luck.

output

array(    [0] => 9    [1] => 8    [2] => 7    [3] => 6    [4] => 5 ) 

not 100% clear, if firstly json string, maybe you'll want?

<?php  $array = <<<end ["9","8","7","6","5"] end;  $php_array = json_decode($array);  $string = join(',', $php_array); $output = explode(',', $string); 

Comments

Popular posts from this blog

Ansible - ERROR! the field 'hosts' is required but was not set -

customize file_field button ruby on rails -

SoapUI on windows 10 - high DPI/4K scaling issue -