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; } } $t = new Test(); echo $t->getStVar(); echo $t->getStVar(); echo $t->getStVar();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/B2tbY
function name:  (null)
number of ops:  13
compiled vars:  !0 = $t
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   24     0  E >   NEW                                              $1      'Test'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   26     3        INIT_METHOD_CALL                                         !0, 'getStVar'
          4        DO_FCALL                                      0  $4      
          5        ECHO                                                     $4
   27     6        INIT_METHOD_CALL                                         !0, 'getStVar'
          7        DO_FCALL                                      0  $5      
          8        ECHO                                                     $5
   28     9        INIT_METHOD_CALL                                         !0, 'getStVar'
         10        DO_FCALL                                      0  $6      
         11        ECHO                                                     $6
         12      > 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/B2tbY
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.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
144.81 ms | 1394 KiB | 13 Q