3v4l.org

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

Class Foo:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/quomT
function name:  __construct
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   INIT_FCALL                                               'var_dump'
          1        SEND_VAL                                                 'created%21'
          2        DO_ICALL                                                 
    8     3      > 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/quomT
function name:  getFoo
number of ops:  8
compiled vars:  !0 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   BIND_STATIC                                              !0
   17     1        COALESCE                                         ~1      !0
          2        NEW                                              $2      'Foo'
          3        DO_FCALL                                      0          
          4        ASSIGN                                           ~4      !0, $2
          5        QM_ASSIGN                                        ~1      ~4
          6      > RETURN                                                   ~1
   18     7*     > RETURN                                                   null

End of function getfoo

End of class Bar.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
168.93 ms | 1396 KiB | 15 Q