3v4l.org

run code in 300+ PHP versions simultaneously
<?php class first { public function getI() { static $a = null; if ($a = null) { $a = new stdClass(); } return $a; } } function foo() { static $a = 1; $a++; print $a."\n"; } var_export($a); foo(); var_export($a); foo(); var_export($a); foo(); var_export($a); foo(); var_export($a); $f = new first(); $n = $f->getI(); var_export($n); var_export($a);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/t7qVY
function name:  (null)
number of ops:  36
compiled vars:  !0 = $a, !1 = $f, !2 = $n
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   INIT_FCALL                                               'var_export'
          1        SEND_VAR                                                 !0
          2        DO_ICALL                                                 
   21     3        INIT_FCALL                                               'foo'
          4        DO_FCALL                                      0          
   22     5        INIT_FCALL                                               'var_export'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                                 
   23     8        INIT_FCALL                                               'foo'
          9        DO_FCALL                                      0          
   24    10        INIT_FCALL                                               'var_export'
         11        SEND_VAR                                                 !0
         12        DO_ICALL                                                 
   25    13        INIT_FCALL                                               'foo'
         14        DO_FCALL                                      0          
   26    15        INIT_FCALL                                               'var_export'
         16        SEND_VAR                                                 !0
         17        DO_ICALL                                                 
   27    18        INIT_FCALL                                               'foo'
         19        DO_FCALL                                      0          
   28    20        INIT_FCALL                                               'var_export'
         21        SEND_VAR                                                 !0
         22        DO_ICALL                                                 
   30    23        NEW                                              $12     'first'
         24        DO_FCALL                                      0          
         25        ASSIGN                                                   !1, $12
   31    26        INIT_METHOD_CALL                                         !1, 'getI'
         27        DO_FCALL                                      0  $15     
         28        ASSIGN                                                   !2, $15
   32    29        INIT_FCALL                                               'var_export'
         30        SEND_VAR                                                 !2
         31        DO_ICALL                                                 
   33    32        INIT_FCALL                                               'var_export'
         33        SEND_VAR                                                 !0
         34        DO_ICALL                                                 
         35      > RETURN                                                   1

Function foo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/t7qVY
function name:  foo
number of ops:  5
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   BIND_STATIC                                              !0
   16     1        PRE_INC                                                  !0
   17     2        CONCAT                                           ~2      !0, '%0A'
          3        ECHO                                                     ~2
   18     4      > RETURN                                                   null

End of function foo

Class first:
Function geti:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 6
Branch analysis from position: 3
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
filename:       /in/t7qVY
function name:  getI
number of ops:  8
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   BIND_STATIC                                              !0
    6     1        ASSIGN                                           ~1      !0, null
          2      > JMPZ                                                     ~1, ->6
    7     3    >   NEW                                              $2      'stdClass'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !0, $2
    9     6    > > RETURN                                                   !0
   10     7*     > RETURN                                                   null

End of function geti

End of class first.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
157.28 ms | 1402 KiB | 19 Q