3v4l.org

run code in 300+ PHP versions simultaneously
<?php $array = [ array_combine(range(1,10), range(1,10)), array_combine(range(11,20), range(11,20)), array_combine(range(21,30), range(21,30)),]; $data = new stdClass(); $data->data = []; $filter = function ($value, $key) use ($data) { if($key > 25) { 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 = 57
Branch analysis from position: 57
1 jumps found. (Code = 62) Position 1 = -2
Found catch point at position: 53
Branch analysis from position: 53
2 jumps found. (Code = 107) Position 1 = 54, Position 2 = -2
Branch analysis from position: 54
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/f5uVU
function name:  (null)
number of ops:  58
compiled vars:  !0 = $array, !1 = $data, !2 = $filter, !3 = $e
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     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        INIT_ARRAY                                       ~7      $6
    5    13        INIT_FCALL                                               'array_combine'
         14        INIT_FCALL                                               'range'
         15        SEND_VAL                                                 11
         16        SEND_VAL                                                 20
         17        DO_ICALL                                         $8      
         18        SEND_VAR                                                 $8
         19        INIT_FCALL                                               'range'
         20        SEND_VAL                                                 11
         21        SEND_VAL                                                 20
         22        DO_ICALL                                         $9      
         23        SEND_VAR                                                 $9
         24        DO_ICALL                                         $10     
         25        ADD_ARRAY_ELEMENT                                ~7      $10
    6    26        INIT_FCALL                                               'array_combine'
         27        INIT_FCALL                                               'range'
         28        SEND_VAL                                                 21
         29        SEND_VAL                                                 30
         30        DO_ICALL                                         $11     
         31        SEND_VAR                                                 $11
         32        INIT_FCALL                                               'range'
         33        SEND_VAL                                                 21
         34        SEND_VAL                                                 30
         35        DO_ICALL                                         $12     
         36        SEND_VAR                                                 $12
         37        DO_ICALL                                         $13     
         38        ADD_ARRAY_ELEMENT                                ~7      $13
    3    39        ASSIGN                                                   !0, ~7
    7    40        NEW                                              $15     'stdClass'
         41        DO_FCALL                                      0          
         42        ASSIGN                                                   !1, $15
    8    43        ASSIGN_OBJ                                               !1, 'data'
         44        OP_DATA                                                  <array>
   10    45        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2Ff5uVU%3A10%240'
         46        BIND_LEXICAL                                             ~19, !1
         47        ASSIGN                                                   !2, ~19
   19    48        INIT_FCALL                                               'array_walk'
         49        SEND_REF                                                 !0
         50        SEND_VAR                                                 !2
         51        DO_ICALL                                                 
         52      > JMP                                                      ->57
   20    53  E > > CATCH                                       last         'Exception'
   21    54    >   INIT_FCALL                                               'var_dump'
         55        SEND_VAR                                                 !1
         56        DO_ICALL                                                 
   22    57    > > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2Ff5uVU%3A10%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/f5uVU
function name:  {closure}
number of ops:  13
compiled vars:  !0 = $value, !1 = $key, !2 = $data
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        BIND_STATIC                                              !2
   11     3        IS_SMALLER                                               25, !1
          4      > JMPZ                                                     ~3, ->9
   12     5    >   NEW                                              $4      'Exception'
          6        DO_FCALL                                      0          
          7      > THROW                                         0          $4
          8*       JMP                                                      ->12
   14     9    >   FETCH_OBJ_W                                      $6      !2, 'data'
         10        ASSIGN_DIM                                               $6
         11        OP_DATA                                                  !0
   16    12      > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2Ff5uVU%3A10%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
174.58 ms | 1400 KiB | 21 Q