3v4l.org

run code in 300+ PHP versions simultaneously
<?php $string = '1/1 [==============================] - 1s 1s/step [ { "image_id": "mahomes1", "mean_score_prediction": 6.3682564571499825 }, { "image_id": "mahomes2", "mean_score_prediction": 6.7501190304756165 }, { "image_id": "mahomes3", "mean_score_prediction": 6.3136263862252235 }, ]'; $string = preg_replace(array('/^[^\v]+/', '/,(\s+\])/'), array('', '$1'), $string); $dict = json_decode($string); print_r($dict);
Output for 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.31, 8.2.0 - 8.2.26, 8.3.0 - 8.3.15, 8.4.1 - 8.4.2
Array ( [0] => stdClass Object ( [image_id] => mahomes1 [mean_score_prediction] => 6.36825645715 ) [1] => stdClass Object ( [image_id] => mahomes2 [mean_score_prediction] => 6.7501190304756 ) [2] => stdClass Object ( [image_id] => mahomes3 [mean_score_prediction] => 6.3136263862252 ) )

preferences:
98.53 ms | 408 KiB | 5 Q