3v4l.org

run code in 300+ PHP versions simultaneously
<?php echo hoge(); function hoge(){ $result = 'error'; try { // このような、try~catch の中で try~catch は変でしょうか? $fuga = (function(){ try { if ( true ) { throw new Exception('error'); } else { return 'ok'; } } catch(Exception $ex) { return $ex->getMessage(); } })(); if ( $fuga === 'ok' ) { $result = 'okです'; } else { throw new Exception('errorです'); } return $result; } catch(Exception $ex) { return $ex->getMessage(); } }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/WVE4N
function name:  (null)
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   INIT_FCALL_BY_NAME                                       'hoge'
          1        DO_FCALL                                      0  $0      
          2        ECHO                                                     $0
   33     3      > RETURN                                                   1

Function hoge:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 9
Branch analysis from position: 7
1 jumps found. (Code = 42) Position 1 = 13
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 9
1 jumps found. (Code = 108) Position 1 = -2
Found catch point at position: 15
Branch analysis from position: 15
2 jumps found. (Code = 107) Position 1 = 16, Position 2 = -2
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/WVE4N
function name:  hoge
number of ops:  20
compiled vars:  !0 = $result, !1 = $fuga, !2 = $ex
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    6     0  E >   ASSIGN                                                   !0, 'error'
   10     1        DECLARE_LAMBDA_FUNCTION                          ~4      [0]
   20     2        INIT_DYNAMIC_CALL                                        ~4
          3        DO_FCALL                                      0  $5      
   10     4        ASSIGN                                                   !1, $5
   22     5        IS_IDENTICAL                                             !1, 'ok'
          6      > JMPZ                                                     ~7, ->9
   23     7    >   ASSIGN                                                   !0, 'ok%E3%81%A7%E3%81%99'
   22     8      > JMP                                                      ->13
   25     9    >   NEW                                              $9      'Exception'
         10        SEND_VAL_EX                                              'error%E3%81%A7%E3%81%99'
         11        DO_FCALL                                      0          
         12      > THROW                                         0          $9
   28    13    > > RETURN                                                   !0
         14*       JMP                                                      ->19
   30    15  E > > CATCH                                       last         'Exception'
   31    16    >   INIT_METHOD_CALL                                         !2, 'getMessage'
         17        DO_FCALL                                      0  $11     
         18      > RETURN                                                   $11
   33    19*     > RETURN                                                   null


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 1, Position 2 = 6
Branch analysis from position: 1
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
Found catch point at position: 8
Branch analysis from position: 8
2 jumps found. (Code = 107) Position 1 = 9, Position 2 = -2
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/WVE4N
function name:  {closure}
number of ops:  13
compiled vars:  !0 = $ex
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E > > JMPZ                                                     <true>, ->6
   13     1    >   NEW                                              $1      'Exception'
          2        SEND_VAL_EX                                              'error'
          3        DO_FCALL                                      0          
          4      > THROW                                         0          $1
   12     5*       JMP                                                      ->7
   15     6    > > RETURN                                                   'ok'
          7*       JMP                                                      ->12
   17     8  E > > CATCH                                       last         'Exception'
   18     9    >   INIT_METHOD_CALL                                         !0, 'getMessage'
         10        DO_FCALL                                      0  $3      
         11      > RETURN                                                   $3
   20    12*     > RETURN                                                   null

End of Dynamic Function 0

End of function hoge

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.91 ms | 1012 KiB | 13 Q