fork download
  1. <?php
  2.  
  3. $original = '{"a":1,"b":2,"c":3,"d":4,"e":5}
  4. {"a":1,"b":2,"c":3,"d":4,"e":5}
  5. {"a":1,"b":2,"c":3,"d":4,"e":5}
  6. {"a":1,"b":2,"c":3,"d":4,"e":5}
  7. {"a":1,"b":2,"c":3,"d":4,"e":5}
  8. {"a":1,"b":2,"c":3,"d":4,"e":5}';
  9.  
  10. $json = '[' . rtrim(str_replace('}', '},', $original), ',') . ']';
  11.  
  12. $arr = json_decode($json, true);
  13.  
  14. foreach ($arr as $item){
  15. echo $item['a'] . ' - ' .$item['b'] .' - '.$item['c'] .' - '.$item['d'] .' - '.$item['e'] .' - '. '<br>';
  16. }
Success #stdin #stdout 0.02s 24400KB
stdin
Standard input is empty
stdout
1 - 2 - 3 - 4 - 5 - <br>1 - 2 - 3 - 4 - 5 - <br>1 - 2 - 3 - 4 - 5 - <br>1 - 2 - 3 - 4 - 5 - <br>1 - 2 - 3 - 4 - 5 - <br>1 - 2 - 3 - 4 - 5 - <br>