3v4l.org

run code in 300+ PHP versions simultaneously
<?php try { $result = array_reduce(range('A', 'E'), function($reduced, $current){ if ($current === 'C') { throw new Exception("Cake!"); } $reduced[] = $current; return $reduced; }); var_dump($result); } catch (Exception $e) { echo "Exception: $e->getMessage()"; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
Found catch point at position: 14
Branch analysis from position: 14
2 jumps found. (Code = 107) Position 1 = 15, Position 2 = -2
Branch analysis from position: 15
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/utE6k
function name:  (null)
number of ops:  21
compiled vars:  !0 = $result, !1 = $e
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   INIT_FCALL                                               'array_reduce'
          1        INIT_FCALL                                               'range'
          2        SEND_VAL                                                 'A'
          3        SEND_VAL                                                 'E'
          4        DO_ICALL                                         $2      
          5        SEND_VAR                                                 $2
          6        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FutE6k%3A4%240'
   11     7        SEND_VAL                                                 ~3
          8        DO_ICALL                                         $4      
    4     9        ASSIGN                                                   !0, $4
   13    10        INIT_FCALL                                               'var_dump'
         11        SEND_VAR                                                 !0
         12        DO_ICALL                                                 
         13      > JMP                                                      ->20
   14    14  E > > CATCH                                       last         'Exception'
   15    15    >   ROPE_INIT                                     3  ~9      'Exception%3A+'
         16        FETCH_OBJ_R                                      ~7      !1, 'getMessage'
         17        ROPE_ADD                                      1  ~9      ~9, ~7
         18        ROPE_END                                      2  ~8      ~9, '%28%29'
         19        ECHO                                                     ~8
   16    20    > > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FutE6k%3A4%240:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 8
Branch analysis from position: 4
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/utE6k
function name:  {closure}
number of ops:  12
compiled vars:  !0 = $reduced, !1 = $current
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    5     2        IS_IDENTICAL                                             !1, 'C'
          3      > JMPZ                                                     ~2, ->8
    6     4    >   NEW                                              $3      'Exception'
          5        SEND_VAL_EX                                              'Cake%21'
          6        DO_FCALL                                      0          
          7      > THROW                                         0          $3
    9     8    >   ASSIGN_DIM                                               !0
          9        OP_DATA                                                  !1
   10    10      > RETURN                                                   !0
   11    11*     > RETURN                                                   null

End of function %00%7Bclosure%7D%2Fin%2FutE6k%3A4%240

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
154.13 ms | 1388 KiB | 19 Q