3v4l.org

run code in 300+ PHP versions simultaneously
<?php class StaticA { public function setEmail($redirect) { $this->email = $redirect; } static function dosomething(){ $obj = new static; $obj->email = "e@01art.de"; $obj->classInfo(); } function classInfo(){ echo get_class(new static). "\n"; echo $this->email. "\n"; } } class StaticB extends StaticA { function test(){ //echo get_class(new self). "\n"; parent::classInfo(); } function doit(){ self::dosomething(); echo self::email. "\n"; } static function dosomething(){ echo "this is overwritten now". $this->email. "\n"; } } $object = new StaticB(); $object->setEmail("erno@01art.de"); $object->doit();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OSFAi
function name:  (null)
number of ops:  9
compiled vars:  !0 = $object
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   40     0  E >   NEW                                              $1      'StaticB'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   41     3        INIT_METHOD_CALL                                         !0, 'setEmail'
          4        SEND_VAL_EX                                              'erno%4001art.de'
          5        DO_FCALL                                      0          
   42     6        INIT_METHOD_CALL                                         !0, 'doit'
          7        DO_FCALL                                      0          
          8      > RETURN                                                   1

Class StaticA:
Function setemail:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OSFAi
function name:  setEmail
number of ops:  4
compiled vars:  !0 = $redirect
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    6     1        ASSIGN_OBJ                                               'email'
          2        OP_DATA                                                  !0
    7     3      > RETURN                                                   null

End of function setemail

Function dosomething:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OSFAi
function name:  dosomething
number of ops:  8
compiled vars:  !0 = $obj
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   10     0  E >   NEW                          static              $1      
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   11     3        ASSIGN_OBJ                                               !0, 'email'
          4        OP_DATA                                                  'e%4001art.de'
   12     5        INIT_METHOD_CALL                                         !0, 'classInfo'
          6        DO_FCALL                                      0          
   13     7      > RETURN                                                   null

End of function dosomething

Function classinfo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OSFAi
function name:  classInfo
number of ops:  9
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   NEW                          static              $0      
          1        DO_FCALL                                      0          
          2        GET_CLASS                                        ~2      $0
          3        CONCAT                                           ~3      ~2, '%0A'
          4        ECHO                                                     ~3
   17     5        FETCH_OBJ_R                                      ~4      'email'
          6        CONCAT                                           ~5      ~4, '%0A'
          7        ECHO                                                     ~5
   18     8      > RETURN                                                   null

End of function classinfo

End of class StaticA.

Class StaticB:
Function test:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OSFAi
function name:  test
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   26     0  E >   INIT_STATIC_METHOD_CALL                                  'classInfo'
          1        DO_FCALL                                      0          
   27     2      > RETURN                                                   null

End of function test

Function doit:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OSFAi
function name:  doit
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   29     0  E >   INIT_STATIC_METHOD_CALL                                  'dosomething'
          1        DO_FCALL                                      0          
   30     2        FETCH_CLASS_CONSTANT                             ~1      'email'
          3        CONCAT                                           ~2      ~1, '%0A'
          4        ECHO                                                     ~2
   31     5      > RETURN                                                   null

End of function doit

Function dosomething:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OSFAi
function name:  dosomething
number of ops:  6
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   35     0  E >   FETCH_THIS                                       $0      
          1        FETCH_OBJ_R                                      ~1      $0, 'email'
          2        CONCAT                                           ~2      'this+is+overwritten+now', ~1
          3        CONCAT                                           ~3      ~2, '%0A'
          4        ECHO                                                     ~3
   36     5      > RETURN                                                   null

End of function dosomething

Function setemail:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OSFAi
function name:  setEmail
number of ops:  4
compiled vars:  !0 = $redirect
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    6     1        ASSIGN_OBJ                                               'email'
          2        OP_DATA                                                  !0
    7     3      > RETURN                                                   null

End of function setemail

Function classinfo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/OSFAi
function name:  classInfo
number of ops:  9
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   NEW                          static              $0      
          1        DO_FCALL                                      0          
          2        GET_CLASS                                        ~2      $0
          3        CONCAT                                           ~3      ~2, '%0A'
          4        ECHO                                                     ~3
   17     5        FETCH_OBJ_R                                      ~4      'email'
          6        CONCAT                                           ~5      ~4, '%0A'
          7        ECHO                                                     ~5
   18     8      > RETURN                                                   null

End of function classinfo

End of class StaticB.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
141.59 ms | 1394 KiB | 13 Q