3v4l.org

run code in 300+ PHP versions simultaneously
<?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);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CF7S4
function name:  (null)
number of ops:  19
compiled vars:  !0 = $arr, !1 = $result
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   ASSIGN                                                   !0, <array>
    4     1        ASSIGN_DIM                                               !0, 2
          2        OP_DATA                                                  <array>
    5     3        ASSIGN_DIM                                               !0, 4
          4        OP_DATA                                                  <array>
    7     5        ASSIGN                                                   !1, <array>
    8     6        INIT_FCALL                                               'array_map'
          7        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FCF7S4%3A8%240'
          8        SEND_VAL                                                 ~7
          9        SEND_VAR                                                 !0
         10        DO_ICALL                                         $8      
         11        CAST                                          8  ~9      $8
         12        ASSIGN_DIM                                               !1, 'bad_lines'
         13        OP_DATA                                                  ~9
    9    14        INIT_FCALL                                               'json_encode'
         15        SEND_VAR                                                 !1
         16        DO_ICALL                                         $10     
         17        ECHO                                                     $10
         18      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FCF7S4%3A8%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/CF7S4
function name:  {closure}
number of ops:  4
compiled vars:  !0 = $line
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   RECV                                             !0      
          1        FETCH_DIM_R                                      ~1      !0, 'error_code'
          2      > RETURN                                                   ~1
          3*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FCF7S4%3A8%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
166.56 ms | 1395 KiB | 17 Q