3v4l.org

run code in 300+ PHP versions simultaneously
<?php $arr = array ( '0' => array("red","green"), '1' => array("blue","yellow"), '2' => array("black","matte","wait" => array("dog","sitter")), '3' => array("one","two","three" => array("sub_three_1","sub_three_2","sub_three_3")) ); $res = explode(",",str_replace(array('[',']',':','}','{'),'',json_encode($arr))); print_r($res);
Output for 5.6.0 - 5.6.40, 7.0.0 - 7.0.33, 7.1.0 - 7.1.33, 7.2.0 - 7.2.33, 7.3.0 - 7.3.33, 7.4.0 - 7.4.33, 8.0.0 - 8.0.30, 8.1.0 - 8.1.28, 8.2.0 - 8.2.18, 8.3.0 - 8.3.7
Array ( [0] => "red" [1] => "green" [2] => "blue" [3] => "yellow" [4] => "0""black" [5] => "1""matte" [6] => "wait""dog" [7] => "sitter" [8] => "0""one" [9] => "1""two" [10] => "three""sub_three_1" [11] => "sub_three_2" [12] => "sub_three_3" )

preferences:
204.71 ms | 404 KiB | 292 Q