3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = array_combine(range(1,10), range(1,10)); $data = new stdClass(); $data->data = []; $filter = function ($value, $key) use ($data) { if($key > 5) { throw new Exception(); } else { $data->data[] = $value; } }; try { array_walk($array, $filter); } catch(Exception $e) { var_dump($data); }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 30
Branch analysis from position: 30
1 jumps found. (Code = 62) Position 1 = -2
Found catch point at position: 26
Branch analysis from position: 26
2 jumps found. (Code = 107) Position 1 = 27, Position 2 = -2
Branch analysis from position: 27
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/p0XYi
function name:  (null)
number of ops:  31
compiled vars:  !0 = $array, !1 = $data, !2 = $filter, !3 = $e
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL                                               'array_combine'
          1        INIT_FCALL                                               'range'
          2        SEND_VAL                                                 1
          3        SEND_VAL                                                 10
          4        DO_ICALL                                         $4      
          5        SEND_VAR                                                 $4
          6        INIT_FCALL                                               'range'
          7        SEND_VAL                                                 1
          8        SEND_VAL                                                 10
          9        DO_ICALL                                         $5      
         10        SEND_VAR                                                 $5
         11        DO_ICALL                                         $6      
         12        ASSIGN                                                   !0, $6
    4    13        NEW                                              $8      'stdClass'
         14        DO_FCALL                                      0          
         15        ASSIGN                                                   !1, $8
    5    16        ASSIGN_OBJ                                               !1, 'data'
         17        OP_DATA                                                  <array>
    7    18        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2Fp0XYi%3A7%240'
         19        BIND_LEXICAL                                             ~12, !1
         20        ASSIGN                                                   !2, ~12
   16    21        INIT_FCALL                                               'array_walk'
         22        SEND_REF                                                 !0
         23        SEND_VAR                                                 !2
         24        DO_ICALL                                                 
         25      > JMP                                                      ->30
   17    26  E > > CATCH                                       last         'Exception'
   18    27    >   INIT_FCALL                                               'var_dump'
         28        SEND_VAR                                                 !1
         29        DO_ICALL                                                 
   19    30    > > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2Fp0XYi%3A7%240:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 9
Branch analysis from position: 5
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/p0XYi
function name:  {closure}
number of ops:  13
compiled vars:  !0 = $value, !1 = $key, !2 = $data
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        BIND_STATIC                                              !2
    8     3        IS_SMALLER                                               5, !1
          4      > JMPZ                                                     ~3, ->9
    9     5    >   NEW                                              $4      'Exception'
          6        DO_FCALL                                      0          
          7      > THROW                                         0          $4
          8*       JMP                                                      ->12
   11     9    >   FETCH_OBJ_W                                      $6      !2, 'data'
         10        ASSIGN_DIM                                               $6
         11        OP_DATA                                                  !0
   13    12      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2Fp0XYi%3A7%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.55 ms | 1405 KiB | 21 Q