3v4l.org

run code in 300+ PHP versions simultaneously
<?php class A { static $methods = array(); function getMethods() { if (!empty(self::$methods)) { print("cached\n"); return self::$methods; } self::$methods[] = 1; return self::$methods; } } $A = new A; print_r($A->getMethods()); $A2 = new A; print_r($A2->getMethods());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8kmTq
function name:  (null)
number of ops:  17
compiled vars:  !0 = $A, !1 = $A2
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   NEW                                              $2      'A'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   21     3        INIT_FCALL                                               'print_r'
          4        INIT_METHOD_CALL                                         !0, 'getMethods'
          5        DO_FCALL                                      0  $5      
          6        SEND_VAR                                                 $5
          7        DO_ICALL                                                 
   23     8        NEW                                              $7      'A'
          9        DO_FCALL                                      0          
         10        ASSIGN                                                   !1, $7
   25    11        INIT_FCALL                                               'print_r'
         12        INIT_METHOD_CALL                                         !1, 'getMethods'
         13        DO_FCALL                                      0  $10     
         14        SEND_VAR                                                 $10
         15        DO_ICALL                                                 
         16      > RETURN                                                   1

Class A:
Function getmethods:
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
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/8kmTq
function name:  getMethods
number of ops:  12
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   ISSET_ISEMPTY_STATIC_PROP                        ~0      'methods'
          1        BOOL_NOT                                         ~1      ~0
          2      > JMPZ                                                     ~1, ->6
    9     3    >   ECHO                                                     'cached%0A'
   10     4        FETCH_STATIC_PROP_R          unknown             ~2      'methods'
          5      > RETURN                                                   ~2
   13     6    >   FETCH_STATIC_PROP_W          unknown             $3      'methods'
          7        ASSIGN_DIM                                               $3
          8        OP_DATA                                                  1
   15     9        FETCH_STATIC_PROP_R          unknown             ~5      'methods'
         10      > RETURN                                                   ~5
   16    11*     > RETURN                                                   null

End of function getmethods

End of class A.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
168.97 ms | 1396 KiB | 15 Q