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()); $z = $x ** 2; return $x * $y; } $a = 'a'; var_dump([foo(5, z: $a), $a]); var_dump([foo(3, -1)]);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/bIDtq
function name:  (null)
number of ops:  20
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   ASSIGN                                                   !0, 'a'
   12     1        INIT_FCALL                                               'var_dump'
          2        INIT_FCALL                                               'foo'
          3        SEND_VAL                                                 5
          4        SEND_REF                                                 !0, 'z'
          5        CHECK_UNDEF_ARGS                                         
          6        DO_FCALL                                      0  $2      
          7        INIT_ARRAY                                       ~3      $2
          8        ADD_ARRAY_ELEMENT                                ~3      !0
          9        SEND_VAL                                                 ~3
         10        DO_ICALL                                                 
   13    11        INIT_FCALL                                               'var_dump'
         12        INIT_FCALL                                               'foo'
         13        SEND_VAL                                                 3
         14        SEND_VAL                                                 -1
         15        DO_FCALL                                      0  $5      
         16        INIT_ARRAY                                       ~6      $5
         17        SEND_VAL                                                 ~6
         18        DO_ICALL                                                 
         19      > RETURN                                                   1

Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/bIDtq
function name:  foo
number of ops:  12
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        POW                                              ~5      !0, 2
          8        ASSIGN                                                   !2, ~5
    8     9        MUL                                              ~7      !0, !1
         10      > RETURN                                                   ~7
    9    11*     > RETURN                                                   null

End of function foo

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
145.05 ms | 1001 KiB | 16 Q