3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { public static $bar; public function getBar() { if (empty(self::$bar)) { self::$bar = new \DateTime(); } return self::$bar; } } var_dump(Foo::$bar); $a = new Foo(); $a->getBar(); var_dump(Foo::$bar);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9FMrW
function name:  (null)
number of ops:  14
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   INIT_FCALL                                               'var_dump'
          1        FETCH_STATIC_PROP_R          global lock         ~1      'bar'
          2        SEND_VAL                                                 ~1
          3        DO_ICALL                                                 
   17     4        NEW                                              $3      'Foo'
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !0, $3
   19     7        INIT_METHOD_CALL                                         !0, 'getBar'
          8        DO_FCALL                                      0          
   21     9        INIT_FCALL                                               'var_dump'
         10        FETCH_STATIC_PROP_R          unknown             ~7      'bar'
         11        SEND_VAL                                                 ~7
         12        DO_ICALL                                                 
         13      > RETURN                                                   1

Class Foo:
Function getbar:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 2, Position 2 = 6
Branch analysis from position: 2
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
filename:       /in/9FMrW
function name:  getBar
number of ops:  9
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   ISSET_ISEMPTY_STATIC_PROP                                'bar'
          1      > JMPZ                                                     ~0, ->6
    8     2    >   NEW                                              $2      'DateTime'
          3        DO_FCALL                                      0          
          4        ASSIGN_STATIC_PROP                                       'bar'
          5        OP_DATA                                                  $2
   11     6    >   FETCH_STATIC_PROP_R          unknown             ~4      'bar'
          7      > RETURN                                                   ~4
   12     8*     > RETURN                                                   null

End of function getbar

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.74 ms | 1395 KiB | 15 Q