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 new FooBar; } @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/H4WGu
function name:  (null)
number of ops:  19
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    >   BEGIN_SILENCE                                    ~2      
          7        INIT_FCALL                                               'var_dump'
          8        INIT_FCALL                                               'test1'
          9        DO_FCALL                                      0  $3      
         10        SEND_VAR                                                 $3
         11        DO_ICALL                                                 
         12        END_SILENCE                                              ~2
   25    13        INIT_FCALL                                               'var_dump'
         14        INIT_FCALL                                               'test'
         15        DO_FCALL                                      0  $5      
         16        SEND_VAR                                                 $5
         17        DO_ICALL                                                 
         18      > RETURN                                                   1

Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/H4WGu
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/H4WGu
function name:  test1
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   NEW                                              $0      'FooBar'
          1        DO_FCALL                                      0          
          2        VERIFY_RETURN_TYPE                                       $0
          3      > RETURN                                                   $0
   20     4*       VERIFY_RETURN_TYPE                                       
          5*     > 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:
154.87 ms | 1399 KiB | 20 Q