3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types=1); function foo(int $x, int $y = 2, ?int &$z = null) { var_dump(func_num_args()); if ($z != null) { $z = $x ** 2; } return $x * $y; } var_dump([foo(5, z: $a), $a]); var_dump([foo(3)]);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/VgfJv
function name:  (null)
number of ops:  18
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_FCALL                                               'foo'
          2        SEND_VAL                                                 5
          3        SEND_REF                                                 !0, 'z'
          4        CHECK_UNDEF_ARGS                                         
          5        DO_FCALL                                      0  $1      
          6        INIT_ARRAY                                       ~2      $1
          7        ADD_ARRAY_ELEMENT                                ~2      !0
          8        SEND_VAL                                                 ~2
          9        DO_ICALL                                                 
   14    10        INIT_FCALL                                               'var_dump'
         11        INIT_FCALL                                               'foo'
         12        SEND_VAL                                                 3
         13        DO_FCALL                                      0  $4      
         14        INIT_ARRAY                                       ~5      $4
         15        SEND_VAL                                                 ~5
         16        DO_ICALL                                                 
         17      > RETURN                                                   1

Function foo:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 9, Position 2 = 11
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
filename:       /in/VgfJv
function name:  foo
number of ops:  14
compiled vars:  !0 = $x, !1 = $y, !2 = $z
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      2
          2        RECV_INIT                                        !2      null
    6     3        INIT_FCALL                                               'var_dump'
          4        FUNC_NUM_ARGS                                    ~3      
          5        SEND_VAL                                                 ~3
          6        DO_ICALL                                                 
    7     7        IS_NOT_EQUAL                                             !2, null
          8      > JMPZ                                                     ~5, ->11
    8     9    >   POW                                              ~6      !0, 2
         10        ASSIGN                                                   !2, ~6
   10    11    >   MUL                                              ~8      !0, !1
         12      > RETURN                                                   ~8
   11    13*     > RETURN                                                   null

End of function foo

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
139.99 ms | 1001 KiB | 16 Q