3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types = 1); phpversion() >= "7.0.0" or die(); class FooBar { public $prop = '123'; } class BarFoo { public $prop = '312'; } function test () : FooBar { return new FooBar; } function test1 () : BarFoo { return void; } var_dump(test1()); var_dump(test());
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 47) Position 1 = 4, Position 2 = 6
Branch analysis from position: 4
1 jumps found. (Code = 79) Position 1 = -2
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4s6mY
function name:  (null)
number of ops:  17
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   INIT_FCALL                                               'phpversion'
          1        DO_ICALL                                         $0      
          2        IS_SMALLER_OR_EQUAL                              ~1      '7.0.0', $0
          3      > JMPNZ_EX                                         ~1      ~1, ->6
          4    > > EXIT                                                     
          5*       BOOL                                             ~1      <true>
   23     6    >   INIT_FCALL                                               'var_dump'
          7        INIT_FCALL                                               'test1'
          8        DO_FCALL                                      0  $2      
          9        SEND_VAR                                                 $2
         10        DO_ICALL                                                 
   25    11        INIT_FCALL                                               'var_dump'
         12        INIT_FCALL                                               'test'
         13        DO_FCALL                                      0  $4      
         14        SEND_VAR                                                 $4
         15        DO_ICALL                                                 
         16      > RETURN                                                   1

Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4s6mY
function name:  test
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   NEW                                              $0      'FooBar'
          1        DO_FCALL                                      0          
          2        VERIFY_RETURN_TYPE                                       $0
          3      > RETURN                                                   $0
   16     4*       VERIFY_RETURN_TYPE                                       
          5*     > RETURN                                                   null

End of function test

Function test1:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/4s6mY
function name:  test1
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   FETCH_CONSTANT                                   ~0      'void'
          1        VERIFY_RETURN_TYPE                                       ~0
          2      > RETURN                                                   ~0
   20     3*       VERIFY_RETURN_TYPE                                       
          4*     > RETURN                                                   null

End of function test1

Class FooBar: [no user functions]
Class BarFoo: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.1 ms | 1399 KiB | 20 Q