3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test { function getStVar() { static $_stVar; $output = ''; if (!isset($_stVar)) { $_stVar = true; $output = '!'; } return $output; } } $t = new Test(); echo $t->getStVar(); echo $t->getStVar();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/3Io11
function name:  (null)
number of ops:  10
compiled vars:  !0 = $t
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   NEW                                              $1      'Test'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   23     3        INIT_METHOD_CALL                                         !0, 'getStVar'
          4        DO_FCALL                                      0  $4      
          5        ECHO                                                     $4
   24     6        INIT_METHOD_CALL                                         !0, 'getStVar'
          7        DO_FCALL                                      0  $5      
          8        ECHO                                                     $5
          9      > RETURN                                                   1

Class Test:
Function getstvar:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 5, Position 2 = 7
Branch analysis from position: 5
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 7
filename:       /in/3Io11
function name:  getStVar
number of ops:  9
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, ->7
   12     5    >   ASSIGN                                                   !0, <true>
   13     6        ASSIGN                                                   !1, '%21'
   16     7    > > RETURN                                                   !1
   17     8*     > RETURN                                                   null

End of function getstvar

End of class Test.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
166 ms | 1398 KiB | 13 Q