3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public function __construct() { echo 'created!'; } } class Bar { protected $foo; public function getFoo() { return $this->foo ?? ($this->foo = new Foo); } } var_dump((new Bar)->getFoo());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/l0Ccd
function name:  (null)
number of ops:  8
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   INIT_FCALL                                               'var_dump'
          1        NEW                                              $0      'Bar'
          2        DO_FCALL                                      0          
          3        INIT_METHOD_CALL                                         $0, 'getFoo'
          4        DO_FCALL                                      0  $2      
          5        SEND_VAR                                                 $2
          6        DO_ICALL                                                 
          7      > RETURN                                                   1

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

End of function __construct

End of class Foo.

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

End of function getfoo

End of class Bar.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
143.98 ms | 1395 KiB | 15 Q