3v4l.org

run code in 300+ PHP versions simultaneously
<?php function foo($v) { if ($v !== 2) { return $v; } throw new Exception('something bad happened'); } function exception_error_handler($errno, $errstr, $errfile, $errline ) { throw new ErrorException($errstr, 0, $errno, $errfile, $errline); } set_error_handler("exception_error_handler"); $data = array(1, 2, 3); try { var_dump(array_map('foo', $data)); } catch (Exception $e) { var_dump(get_class($e), $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: 12
Branch analysis from position: 12
2 jumps found. (Code = 107) Position 1 = 13, Position 2 = -2
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GNn97
function name:  (null)
number of ops:  21
compiled vars:  !0 = $data, !1 = $e
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   INIT_FCALL                                               'set_error_handler'
          1        SEND_VAL                                                 'exception_error_handler'
          2        DO_ICALL                                                 
   16     3        ASSIGN                                                   !0, <array>
   19     4        INIT_FCALL                                               'var_dump'
          5        INIT_FCALL                                               'array_map'
          6        SEND_VAL                                                 'foo'
          7        SEND_VAR                                                 !0
          8        DO_ICALL                                         $4      
          9        SEND_VAR                                                 $4
         10        DO_ICALL                                                 
         11      > JMP                                                      ->20
   20    12  E > > CATCH                                       last         'Exception'
   21    13    >   INIT_FCALL                                               'var_dump'
         14        GET_CLASS                                        ~6      !1
         15        SEND_VAL                                                 ~6
         16        INIT_METHOD_CALL                                         !1, 'getMessage'
         17        DO_FCALL                                      0  $7      
         18        SEND_VAR                                                 $7
         19        DO_ICALL                                                 
   22    20    > > RETURN                                                   1

Function foo:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 4
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 4
1 jumps found. (Code = 108) Position 1 = -2
filename:       /in/GNn97
function name:  foo
number of ops:  9
compiled vars:  !0 = $v
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
    5     1        IS_NOT_IDENTICAL                                         !0, 2
          2      > JMPZ                                                     ~1, ->4
    6     3    > > RETURN                                                   !0
    9     4    >   NEW                                              $2      'Exception'
          5        SEND_VAL_EX                                              'something+bad+happened'
          6        DO_FCALL                                      0          
          7      > THROW                                         0          $2
   10     8*     > RETURN                                                   null

End of function foo

Function exception_error_handler:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 108) Position 1 = -2
filename:       /in/GNn97
function name:  exception_error_handler
number of ops:  13
compiled vars:  !0 = $errno, !1 = $errstr, !2 = $errfile, !3 = $errline
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   RECV                                             !0      
          1        RECV                                             !1      
          2        RECV                                             !2      
          3        RECV                                             !3      
   12     4        NEW                                              $4      'ErrorException'
          5        SEND_VAR_EX                                              !1
          6        SEND_VAL_EX                                              0
          7        SEND_VAR_EX                                              !0
          8        SEND_VAR_EX                                              !2
          9        SEND_VAR_EX                                              !3
         10        DO_FCALL                                      0          
         11      > THROW                                         0          $4
   13    12*     > RETURN                                                   null

End of function exception_error_handler

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.63 ms | 1400 KiB | 19 Q