3v4l.org

run code in 500+ PHP versions simultaneously
<?php class A { private static int $a = 6; private static function foo(): int { return 5; } public function run(): void { var_dump($this->foo()); var_dump($this::foo()); var_dump(static::foo()); echo "\n-----------\n"; var_dump($this::$a); var_dump(static::$a); echo "\n-----------\n"; $other = new static(); var_dump($other->foo()); var_dump($other::foo()); } } class B extends A { public static string $a = 'b'; public static function foo(): string { return "a"; } } (new B)->run();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/SuYOd
function name:  (null)
number of ops:  5
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   39     0  E >   NEW                                                  $0      'B'
          1        DO_FCALL                                          0          
          2        INIT_METHOD_CALL                                             $0, 'run'
          3        DO_FCALL                                          0          
          4      > RETURN                                                       1

Class A:
Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/SuYOd
function name:  foo
number of ops:  3
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    7     0  E > > RETURN                                                       5
    8     1*       VERIFY_RETURN_TYPE                                           
          2*     > RETURN                                                       null

End of function foo

Function run:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/SuYOd
function name:  run
number of ops:  44
compiled vars:  !0 = $other
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   12     0  E >   INIT_FCALL                                                   'var_dump'
          1        INIT_METHOD_CALL                                             'foo'
          2        DO_FCALL                                          0  $1      
          3        SEND_VAR                                                     $1
          4        DO_ICALL                                                     
   13     5        INIT_FCALL                                                   'var_dump'
          6        FETCH_THIS                                           ~3      
          7        FETCH_CLASS                                       0  $4      ~3
          8        INIT_STATIC_METHOD_CALL                                      $4, 'foo'
          9        DO_FCALL                                          0  $5      
         10        SEND_VAR                                                     $5
         11        DO_ICALL                                                     
   14    12        INIT_FCALL                                                   'var_dump'
         13        INIT_STATIC_METHOD_CALL                                      'foo'
         14        DO_FCALL                                          0  $7      
         15        SEND_VAR                                                     $7
         16        DO_ICALL                                                     
   16    17        ECHO                                                         '%0A-----------%0A'
   18    18        INIT_FCALL                                                   'var_dump'
         19        FETCH_THIS                                           ~9      
         20        FETCH_CLASS                                       0  $10     ~9
         21        FETCH_STATIC_PROP_R              unknown             ~11     'a'
         22        SEND_VAL                                                     ~11
         23        DO_ICALL                                                     
   19    24        INIT_FCALL                                                   'var_dump'
         25        FETCH_STATIC_PROP_R              unknown             ~13     'a'
         26        SEND_VAL                                                     ~13
         27        DO_ICALL                                                     
   21    28        ECHO                                                         '%0A-----------%0A'
   23    29        NEW                              static              $15     
         30        DO_FCALL                                          0          
         31        ASSIGN                                                       !0, $15
   25    32        INIT_FCALL                                                   'var_dump'
         33        INIT_METHOD_CALL                                             !0, 'foo'
         34        DO_FCALL                                          0  $18     
         35        SEND_VAR                                                     $18
         36        DO_ICALL                                                     
   26    37        INIT_FCALL                                                   'var_dump'
         38        FETCH_CLASS                                       0  $20     !0
         39        INIT_STATIC_METHOD_CALL                                      $20, 'foo'
         40        DO_FCALL                                          0  $21     
         41        SEND_VAR                                                     $21
         42        DO_ICALL                                                     
   27    43      > RETURN                                                       null

End of function run

End of class A.

Class B:
Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/SuYOd
function name:  foo
number of ops:  3
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   35     0  E > > RETURN                                                       'a'
   36     1*       VERIFY_RETURN_TYPE                                           
          2*     > RETURN                                                       null

End of function foo

Function run:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/SuYOd
function name:  run
number of ops:  44
compiled vars:  !0 = $other
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   12     0  E >   INIT_FCALL                                                   'var_dump'
          1        INIT_METHOD_CALL                                             'foo'
          2        DO_FCALL                                          0  $1      
          3        SEND_VAR                                                     $1
          4        DO_ICALL                                                     
   13     5        INIT_FCALL                                                   'var_dump'
          6        FETCH_THIS                                           ~3      
          7        FETCH_CLASS                                       0  $4      ~3
          8        INIT_STATIC_METHOD_CALL                                      $4, 'foo'
          9        DO_FCALL                                          0  $5      
         10        SEND_VAR                                                     $5
         11        DO_ICALL                                                     
   14    12        INIT_FCALL                                                   'var_dump'
         13        INIT_STATIC_METHOD_CALL                                      'foo'
         14        DO_FCALL                                          0  $7      
         15        SEND_VAR                                                     $7
         16        DO_ICALL                                                     
   16    17        ECHO                                                         '%0A-----------%0A'
   18    18        INIT_FCALL                                                   'var_dump'
         19        FETCH_THIS                                           ~9      
         20        FETCH_CLASS                                       0  $10     ~9
         21        FETCH_STATIC_PROP_R              unknown             ~11     'a'
         22        SEND_VAL                                                     ~11
         23        DO_ICALL                                                     
   19    24        INIT_FCALL                                                   'var_dump'
         25        FETCH_STATIC_PROP_R              unknown             ~13     'a'
         26        SEND_VAL                                                     ~13
         27        DO_ICALL                                                     
   21    28        ECHO                                                         '%0A-----------%0A'
   23    29        NEW                              static              $15     
         30        DO_FCALL                                          0          
         31        ASSIGN                                                       !0, $15
   25    32        INIT_FCALL                                                   'var_dump'
         33        INIT_METHOD_CALL                                             !0, 'foo'
         34        DO_FCALL                                          0  $18     
         35        SEND_VAR                                                     $18
         36        DO_ICALL                                                     
   26    37        INIT_FCALL                                                   'var_dump'
         38        FETCH_CLASS                                       0  $20     !0
         39        INIT_STATIC_METHOD_CALL                                      $20, 'foo'
         40        DO_FCALL                                          0  $21     
         41        SEND_VAR                                                     $21
         42        DO_ICALL                                                     
   27    43      > RETURN                                                       null

End of function run

End of class B.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
155.73 ms | 1415 KiB | 14 Q