3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test { function getStVar() { static $_stVar; $output = ''; if (!isset($_stVar)) { $_stVar = true; $output = '!'; } else { $output = '.'; } return $output; } } class TestExt_1 extends Test { } class TestExt_2 extends Test { } $t = new Test(); $tt = new Test(); echo $t->getStVar(); echo $tt->getStVar(); echo $t->getStVar(); echo $tt->getStVar(); exit(); $t1 = new TestExt_1(); $t2 = new TestExt_2(); echo $t1->getStVar(); echo $t1->getStVar(); echo $t2->getStVar(); echo $t2->getStVar();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 79) Position 1 = -2
filename:       /in/rUGX3
function name:  (null)
number of ops:  38
compiled vars:  !0 = $t, !1 = $tt, !2 = $t1, !3 = $t2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   32     0  E >   NEW                                              $4      'Test'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $4
   33     3        NEW                                              $7      'Test'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !1, $7
   35     6        INIT_METHOD_CALL                                         !0, 'getStVar'
          7        DO_FCALL                                      0  $10     
          8        ECHO                                                     $10
   36     9        INIT_METHOD_CALL                                         !1, 'getStVar'
         10        DO_FCALL                                      0  $11     
         11        ECHO                                                     $11
   37    12        INIT_METHOD_CALL                                         !0, 'getStVar'
         13        DO_FCALL                                      0  $12     
         14        ECHO                                                     $12
   38    15        INIT_METHOD_CALL                                         !1, 'getStVar'
         16        DO_FCALL                                      0  $13     
         17        ECHO                                                     $13
   40    18      > EXIT                                                     
   42    19*       NEW                                              $14     'TestExt_1'
         20*       DO_FCALL                                      0          
         21*       ASSIGN                                                   !2, $14
   43    22*       NEW                                              $17     'TestExt_2'
         23*       DO_FCALL                                      0          
         24*       ASSIGN                                                   !3, $17
   45    25*       INIT_METHOD_CALL                                         !2, 'getStVar'
         26*       DO_FCALL                                      0  $20     
         27*       ECHO                                                     $20
   46    28*       INIT_METHOD_CALL                                         !2, 'getStVar'
         29*       DO_FCALL                                      0  $21     
         30*       ECHO                                                     $21
   47    31*       INIT_METHOD_CALL                                         !3, 'getStVar'
         32*       DO_FCALL                                      0  $22     
         33*       ECHO                                                     $22
   48    34*       INIT_METHOD_CALL                                         !3, 'getStVar'
         35*       DO_FCALL                                      0  $23     
         36*       ECHO                                                     $23
         37*     > RETURN                                                   1

Class Test:
Function getstvar:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 8
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/rUGX3
function name:  getStVar
number of ops:  11
compiled vars:  !0 = $_stVar, !1 = $output
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   BIND_STATIC                                              !0
    9     1        ASSIGN                                                   !1, ''
   11     2        ISSET_ISEMPTY_CV                                 ~3      !0
          3        BOOL_NOT                                         ~4      ~3
          4      > JMPZ                                                     ~4, ->8
   12     5    >   ASSIGN                                                   !0, <true>
   13     6        ASSIGN                                                   !1, '%21'
          7      > JMP                                                      ->9
   16     8    >   ASSIGN                                                   !1, '.'
   19     9    > > RETURN                                                   !1
   20    10*     > RETURN                                                   null

End of function getstvar

End of class Test.

Class TestExt_1:
Function getstvar:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 8
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/rUGX3
function name:  getStVar
number of ops:  11
compiled vars:  !0 = $_stVar, !1 = $output
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   BIND_STATIC                                              !0
    9     1        ASSIGN                                                   !1, ''
   11     2        ISSET_ISEMPTY_CV                                 ~3      !0
          3        BOOL_NOT                                         ~4      ~3
          4      > JMPZ                                                     ~4, ->8
   12     5    >   ASSIGN                                                   !0, <true>
   13     6        ASSIGN                                                   !1, '%21'
          7      > JMP                                                      ->9
   16     8    >   ASSIGN                                                   !1, '.'
   19     9    > > RETURN                                                   !1
   20    10*     > RETURN                                                   null

End of function getstvar

End of class TestExt_1.

Class TestExt_2:
Function getstvar:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 8
Branch analysis from position: 5
1 jumps found. (Code = 42) Position 1 = 9
Branch analysis from position: 9
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 8
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/rUGX3
function name:  getStVar
number of ops:  11
compiled vars:  !0 = $_stVar, !1 = $output
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   BIND_STATIC                                              !0
    9     1        ASSIGN                                                   !1, ''
   11     2        ISSET_ISEMPTY_CV                                 ~3      !0
          3        BOOL_NOT                                         ~4      ~3
          4      > JMPZ                                                     ~4, ->8
   12     5    >   ASSIGN                                                   !0, <true>
   13     6        ASSIGN                                                   !1, '%21'
          7      > JMP                                                      ->9
   16     8    >   ASSIGN                                                   !1, '.'
   19     9    > > RETURN                                                   !1
   20    10*     > RETURN                                                   null

End of function getstvar

End of class TestExt_2.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
153.82 ms | 1403 KiB | 13 Q