3v4l.org

run code in 300+ PHP versions simultaneously
<?php $callable = fn() => throw new Exception(); $myValue = true; $value = $myValue ? 'something' : throw new Exception(); $value = $myValue ?: throw new Exception(); $myValue = false; $value = $myValue ? throw new Exception() : 'something'; $nullableValue = 1; $value = $nullableValue ?? throw new Exception(); $value = true; $value ??= throw new Exception(); $condition = false; $condition && throw new Exception(); $condition and throw new Exception(); $condition = true; $condition || throw new Exception(); $condition or throw new Exception(); // $condition xor throw new Exception(); echo 'still executable as throw, in all of the above cases, is used as part of an expression';
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 6
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 6
1 jumps found. (Code = 108) Position 1 = -2
filename:       /in/AmMf2
function name:  (null)
number of ops:  65
compiled vars:  !0 = $callable, !1 = $myValue, !2 = $value, !3 = $nullableValue, !4 = $condition
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   DECLARE_LAMBDA_FUNCTION                          ~5      [0]
          1        ASSIGN                                                   !0, ~5
    4     2        ASSIGN                                                   !1, <true>
    5     3      > JMPZ                                                     !1, ->6
          4    >   QM_ASSIGN                                        ~8      'something'
          5      > JMP                                                      ->10
          6    >   NEW                                              $9      'Exception'
          7        DO_FCALL                                      0          
          8      > THROW                                         1          $9
          9*       QM_ASSIGN                                        ~8      <true>
         10    >   ASSIGN                                                   !2, ~8
    6    11        JMP_SET                                          ~12     !1, ->16
         12        NEW                                              $13     'Exception'
         13        DO_FCALL                                      0          
         14      > THROW                                         1          $13
         15*       QM_ASSIGN                                        ~12     <true>
         16*       ASSIGN                                                   !2, ~12
    7    17*       ASSIGN                                                   !1, <false>
    8    18*       JMPZ                                                     !1, ->24
         19*       NEW                                              $17     'Exception'
         20*       DO_FCALL                                      0          
         21*       THROW                                         1          $17
         22*       QM_ASSIGN                                        ~19     <true>
         23*       JMP                                                      ->25
         24*       QM_ASSIGN                                        ~19     'something'
         25*       ASSIGN                                                   !2, ~19
   10    26*       ASSIGN                                                   !3, 1
   11    27*       COALESCE                                         ~22     !3
         28*       NEW                                              $23     'Exception'
         29*       DO_FCALL                                      0          
         30*       THROW                                         1          $23
         31*       QM_ASSIGN                                        ~22     <true>
         32*       ASSIGN                                                   !2, ~22
   12    33*       ASSIGN                                                   !2, <true>
   13    34*       COALESCE                                         ~27     !2
         35*       NEW                                              $28     'Exception'
         36*       DO_FCALL                                      0          
         37*       THROW                                         1          $28
         38*       ASSIGN                                           ~30     !2, <true>
         39*       QM_ASSIGN                                        ~27     ~30
         40*       FREE                                                     ~27
   15    41*       ASSIGN                                                   !4, <false>
   16    42*       JMPZ_EX                                          ~32     !4, ->47
         43*       NEW                                              $33     'Exception'
         44*       DO_FCALL                                      0          
         45*       THROW                                         1          $33
         46*       BOOL                                             ~32     <true>
   17    47*       JMPZ_EX                                          ~35     !4, ->52
         48*       NEW                                              $36     'Exception'
         49*       DO_FCALL                                      0          
         50*       THROW                                         1          $36
         51*       BOOL                                             ~35     <true>
   19    52*       ASSIGN                                                   !4, <true>
   20    53*       JMPNZ_EX                                         ~39     !4, ->58
         54*       NEW                                              $40     'Exception'
         55*       DO_FCALL                                      0          
         56*       THROW                                         1          $40
         57*       BOOL                                             ~39     <true>
   21    58*       JMPNZ_EX                                         ~42     !4, ->63
         59*       NEW                                              $43     'Exception'
         60*       DO_FCALL                                      0          
         61*       THROW                                         1          $43
         62*       BOOL                                             ~42     <true>
   24    63*       ECHO                                                     'still+executable+as+throw%2C+in+all+of+the+above+cases%2C+is+used+as+part+of+an+expression'
         64*     > RETURN                                                   1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 108) Position 1 = -2
filename:       /in/AmMf2
function name:  {closure}
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    2     0  E >   NEW                                              $0      'Exception'
          1        DO_FCALL                                      0          
          2      > THROW                                         1          $0
          3*       RETURN                                                   <true>
          4*     > RETURN                                                   null

End of Dynamic Function 0

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
137.12 ms | 1002 KiB | 13 Q