3v4l.org

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

Function foo:
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 = 62) Position 1 = -2
Branch analysis from position: 6
filename:       /in/dYu5h
function name:  foo
number of ops:  9
compiled vars:  !0 = $x, !1 = $y
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        RECV_INIT                                        !1      null
    6     2        TYPE_CHECK                                  1020          !1
          3      > JMPZ                                                     ~2, ->6
    7     4    >   POW                                              ~3      !0, 2
          5        ASSIGN                                                   !1, ~3
    9     6    >   MUL                                              ~5      !0, 2
          7      > RETURN                                                   ~5
   10     8*     > RETURN                                                   null

End of function foo

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
141.46 ms | 999 KiB | 15 Q