3v4l.org

run code in 300+ PHP versions simultaneously
<?php function example($reduced, $current) { if ($current === 'C') { throw new Exception("Cake!"); } $reduced[] = $current; return $reduced; }; try { $result = array_reduce(range('A', 'E'), 'example'); 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 = 18
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Found catch point at position: 13
Branch analysis from position: 13
2 jumps found. (Code = 107) Position 1 = 14, Position 2 = -2
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/tTjUA
function name:  (null)
number of ops:  19
compiled vars:  !0 = $result, !1 = $e
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     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        SEND_VAL                                                 'example'
          7        DO_ICALL                                         $3      
          8        ASSIGN                                                   !0, $3
   15     9        INIT_FCALL                                               'var_dump'
         10        SEND_VAR                                                 !0
         11        DO_ICALL                                                 
         12      > JMP                                                      ->18
   16    13  E > > CATCH                                       last         'Exception'
   17    14    >   INIT_METHOD_CALL                                         !1, 'getMessage'
         15        DO_FCALL                                      0  $6      
         16        CONCAT                                           ~7      'Exception%3A+', $6
         17        ECHO                                                     ~7
   18    18    > > RETURN                                                   1

Function example:
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/tTjUA
function name:  example
number of ops:  12
compiled vars:  !0 = $reduced, !1 = $current
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     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 example

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
168.97 ms | 1396 KiB | 19 Q