3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { private static DateTimeImmutable $bar; private static ?string $foo; public static function getBar(): DateTimeImmutable { return self::$bar ??= new DateTimeImmutable(); } public static function getFoo(): ?string { return self::$foo ??= null; } public static function setFoo(string $foo): void { self::$foo = $foo; } } var_dump(Foo::getBar()); var_dump(Foo::getBar()); var_dump(Foo::getFoo()); Foo::setFoo('test'); var_dump(Foo::getFoo());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/JiuaG
function name:  (null)
number of ops:  24
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   INIT_FCALL                                               'var_dump'
          1        INIT_STATIC_METHOD_CALL                                  'Foo', 'getBar'
          2        DO_FCALL                                      0  $0      
          3        SEND_VAR                                                 $0
          4        DO_ICALL                                                 
   24     5        INIT_FCALL                                               'var_dump'
          6        INIT_STATIC_METHOD_CALL                                  'Foo', 'getBar'
          7        DO_FCALL                                      0  $2      
          8        SEND_VAR                                                 $2
          9        DO_ICALL                                                 
   25    10        INIT_FCALL                                               'var_dump'
         11        INIT_STATIC_METHOD_CALL                                  'Foo', 'getFoo'
         12        DO_FCALL                                      0  $4      
         13        SEND_VAR                                                 $4
         14        DO_ICALL                                                 
   26    15        INIT_STATIC_METHOD_CALL                                  'Foo', 'setFoo'
         16        SEND_VAL                                                 'test'
         17        DO_FCALL                                      0          
   27    18        INIT_FCALL                                               'var_dump'
         19        INIT_STATIC_METHOD_CALL                                  'Foo', 'getFoo'
         20        DO_FCALL                                      0  $7      
         21        SEND_VAR                                                 $7
         22        DO_ICALL                                                 
         23      > RETURN                                                   1

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

End of function getbar

Function getfoo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/JiuaG
function name:  getFoo
number of ops:  9
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   FETCH_STATIC_PROP_IS                             ~0      'foo'
          1        COALESCE                                         ~1      ~0
          2        ASSIGN_STATIC_PROP                               ~2      'foo'
          3        OP_DATA                                                  null
          4        QM_ASSIGN                                        ~1      ~2
          5        VERIFY_RETURN_TYPE                                       ~1
          6      > RETURN                                                   ~1
   15     7*       VERIFY_RETURN_TYPE                                       
          8*     > RETURN                                                   null

End of function getfoo

Function setfoo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/JiuaG
function name:  setFoo
number of ops:  4
compiled vars:  !0 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   RECV                                             !0      
   19     1        ASSIGN_STATIC_PROP                                       'foo'
          2        OP_DATA                                                  !0
   20     3      > RETURN                                                   null

End of function setfoo

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
166.46 ms | 1400 KiB | 15 Q