3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public function __construct() { echo 'foo'; } } class Bar { public function __construct() { echo 'bar'; } } class Build { private ?Foo $foo = null; private ?Bar $bar = null; function foo(): Foo { return $this->foo ?? new Foo(); } function bar(): Bar { return $this->bar ??= new Bar(); } } $build = new Build(); $build->foo(); $build->foo(); $build->bar(); $build->bar();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/eA6k0
function name:  (null)
number of ops:  12
compiled vars:  !0 = $build
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   28     0  E >   NEW                                              $1      'Build'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   29     3        INIT_METHOD_CALL                                         !0, 'foo'
          4        DO_FCALL                                      0          
          5        INIT_METHOD_CALL                                         !0, 'foo'
          6        DO_FCALL                                      0          
   30     7        INIT_METHOD_CALL                                         !0, 'bar'
          8        DO_FCALL                                      0          
          9        INIT_METHOD_CALL                                         !0, 'bar'
         10        DO_FCALL                                      0          
         11      > RETURN                                                   1

Class Foo:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/eA6k0
function name:  __construct
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   ECHO                                                     'foo'
    6     1      > RETURN                                                   null

End of function __construct

End of class Foo.

Class Bar:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/eA6k0
function name:  __construct
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   ECHO                                                     'bar'
   12     1      > RETURN                                                   null

End of function __construct

End of class Bar.

Class Build:
Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/eA6k0
function name:  foo
number of ops:  9
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   FETCH_OBJ_IS                                     ~0      'foo'
          1        COALESCE                                         ~1      ~0
          2        NEW                                              $2      'Foo'
          3        DO_FCALL                                      0          
          4        QM_ASSIGN                                        ~1      $2
          5        VERIFY_RETURN_TYPE                                       ~1
          6      > RETURN                                                   ~1
   21     7*       VERIFY_RETURN_TYPE                                       
          8*     > RETURN                                                   null

End of function foo

Function bar:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/eA6k0
function name:  bar
number of ops:  11
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   24     0  E >   FETCH_OBJ_IS                                     ~0      'bar'
          1        COALESCE                                         ~1      ~0
          2        NEW                                              $2      'Bar'
          3        DO_FCALL                                      0          
          4        ASSIGN_OBJ                                       ~4      'bar'
          5        OP_DATA                                                  $2
          6        QM_ASSIGN                                        ~1      ~4
          7        VERIFY_RETURN_TYPE                                       ~1
          8      > RETURN                                                   ~1
   25     9*       VERIFY_RETURN_TYPE                                       
         10*     > RETURN                                                   null

End of function bar

End of class Build.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
174.59 ms | 1002 KiB | 13 Q