3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types=1); function foo(int $x, ?int &$y) { var_dump(isset($y)); if ($y != null) { $y = $x ** 2; } return $x * 2; } var_dump([foo(5, $a), $a]); var_dump([foo(3)]);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/3WkiP
function name:  (null)
number of ops:  17
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
          4        DO_FCALL                                      0  $1      
          5        INIT_ARRAY                                       ~2      $1
          6        ADD_ARRAY_ELEMENT                                ~2      !0
          7        SEND_VAL                                                 ~2
          8        DO_ICALL                                                 
   14     9        INIT_FCALL                                               'var_dump'
         10        INIT_FCALL                                               'foo'
         11        SEND_VAL                                                 3
         12        DO_FCALL                                      0  $4      
         13        INIT_ARRAY                                       ~5      $4
         14        SEND_VAL                                                 ~5
         15        DO_ICALL                                                 
         16      > RETURN                                                   1

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

End of function foo

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
139.14 ms | 1001 KiB | 16 Q