Convert Array in PHP -
i have array database this
{ 0 : "test1", 1 : "test2", 2 : "test3" }
how can convert array in php? this
array[0] = "test1" array[1] = "test2" array[2] = "test3"
------------------------------------------ update ------------------------------------
it doesn't work json_decode. allredy test (i work xajax):
$value = $obj->getvalue($id); //get array database $json = $value["datas"]; //save datas in $json print_r($json); //print out data in console print_r("\n"); var_dump(json_decode($json,true)); //print out decoded value in console
then shows in console message:
{0:"rechenzentren.png",1:"software.png"} <pre class='xdebug-var-dump' dir='ltr'><font color='#3465a4'>null</font></pre> <?xml version="1.0" encoding="utf-8" ?><xjx></xjx>
$text = '{ 0 : "test1", 1 : "test2", 2 : "test3" }'; $text = preg_replace('/(\d+)\s*:/ism', '"$1":', $text); $array = json_decode($text, true); var_dump($array);
Comments
Post a Comment