3v4l.org

run code in 300+ PHP versions simultaneously
<?php function test(...$set) { if (count($set) === 0) { throw new \ArgumentCountError('can throw'); } var_dump(count($set)); } try { test(1); test(1, 2); test(); } catch (\ArgumentCountError $e) { echo $e; }
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 42) Position 1 = 12
Branch analysis from position: 12
1 jumps found. (Code = 62) Position 1 = -2
Found catch point at position: 10
Branch analysis from position: 10
2 jumps found. (Code = 107) Position 1 = 11, Position 2 = -2
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/LDCNF
function name:  (null)
number of ops:  13
compiled vars:  !0 = $e
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   INIT_FCALL                                               'test'
          1        SEND_VAL                                                 1
          2        DO_FCALL                                      0          
   12     3        INIT_FCALL                                               'test'
          4        SEND_VAL                                                 1
          5        SEND_VAL                                                 2
          6        DO_FCALL                                      0          
   13     7        INIT_FCALL                                               'test'
          8        DO_FCALL                                      0          
          9      > JMP                                                      ->12
   14    10  E > > CATCH                                       last         'ArgumentCountError'
   15    11    >   ECHO                                                     !0
   16    12    > > RETURN                                                   1

Function test:
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/LDCNF
function name:  test
number of ops:  13
compiled vars:  !0 = $set
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV_VARIADIC                                    !0      
    4     1        COUNT                                            ~1      !0
          2        IS_IDENTICAL                                             ~1, 0
          3      > JMPZ                                                     ~2, ->8
    5     4    >   NEW                                              $3      'ArgumentCountError'
          5        SEND_VAL_EX                                              'can+throw'
          6        DO_FCALL                                      0          
          7      > THROW                                         0          $3
    7     8    >   INIT_FCALL                                               'var_dump'
          9        COUNT                                            ~5      !0
         10        SEND_VAL                                                 ~5
         11        DO_ICALL                                                 
    8    12      > RETURN                                                   null

End of function test

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
158.59 ms | 1390 KiB | 18 Q