3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $arr = []; $arr[2] = ['error_code' => 'a']; $arr[4] = ['error_code' => 'b']; $result = []; $result['bad_lines'] = (object)array_map(function($line) { return $line['error_code']; }, $arr); echo json_encode($result);
based on nTeo3
Output for 5.6.0 - 5.6.30, hhvm-3.15.4, 7.0.0 - 7.2.0
{"bad_lines":{"2":"a","4":"b"}}