3v4l.org

run code in 300+ PHP versions simultaneously
<?php abstract class Mother { /** @var array */ private static $inMemoryCache = []; public function testMethod($param) { $cacheKey = '_'.$param; if (!isset(self::$inMemoryCache[$cacheKey])) { echo PHP_EOL, 'compute result', PHP_EOL; self::$inMemoryCache[$cacheKey] = $param * 2; } return self::$inMemoryCache[$cacheKey]; } } final class Daughter extends Mother { } final class Son extends Mother { } $d = new Daughter(); $s = new Son(); $d->testMethod(1); $d->testMethod(1); $s->testMethod(1); $s->testMethod(1);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/j03Dp
function name:  (null)
number of ops:  19
compiled vars:  !0 = $d, !1 = $s
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   28     0  E >   NEW                                              $2      'Daughter'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   29     3        NEW                                              $5      'Son'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !1, $5
   31     6        INIT_METHOD_CALL                                         !0, 'testMethod'
          7        SEND_VAL_EX                                              1
          8        DO_FCALL                                      0          
   32     9        INIT_METHOD_CALL                                         !0, 'testMethod'
         10        SEND_VAL_EX                                              1
         11        DO_FCALL                                      0          
   33    12        INIT_METHOD_CALL                                         !1, 'testMethod'
         13        SEND_VAL_EX                                              1
         14        DO_FCALL                                      0          
   34    15        INIT_METHOD_CALL                                         !1, 'testMethod'
         16        SEND_VAL_EX                                              1
         17        DO_FCALL                                      0          
         18      > RETURN                                                   1

Class Mother:
Function testmethod:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 14
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
filename:       /in/j03Dp
function name:  testMethod
number of ops:  18
compiled vars:  !0 = $param, !1 = $cacheKey
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    9     1        CONCAT                                           ~2      '_', !0
          2        ASSIGN                                                   !1, ~2
   11     3        FETCH_STATIC_PROP_IS                             ~4      'inMemoryCache'
          4        ISSET_ISEMPTY_DIM_OBJ                         0  ~5      ~4, !1
          5        BOOL_NOT                                         ~6      ~5
          6      > JMPZ                                                     ~6, ->14
   12     7    >   ECHO                                                     '%0A'
          8        ECHO                                                     'compute+result'
          9        ECHO                                                     '%0A'
   13    10        MUL                                              ~9      !0, 2
         11        FETCH_STATIC_PROP_W          unknown             $7      'inMemoryCache'
         12        ASSIGN_DIM                                               $7, !1
         13        OP_DATA                                                  ~9
   16    14    >   FETCH_STATIC_PROP_R          unknown             ~10     'inMemoryCache'
         15        FETCH_DIM_R                                      ~11     ~10, !1
         16      > RETURN                                                   ~11
   17    17*     > RETURN                                                   null

End of function testmethod

End of class Mother.

Class Daughter:
Function testmethod:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 14
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
filename:       /in/j03Dp
function name:  testMethod
number of ops:  18
compiled vars:  !0 = $param, !1 = $cacheKey
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    9     1        CONCAT                                           ~2      '_', !0
          2        ASSIGN                                                   !1, ~2
   11     3        FETCH_STATIC_PROP_IS                             ~4      'inMemoryCache'
          4        ISSET_ISEMPTY_DIM_OBJ                         0  ~5      ~4, !1
          5        BOOL_NOT                                         ~6      ~5
          6      > JMPZ                                                     ~6, ->14
   12     7    >   ECHO                                                     '%0A'
          8        ECHO                                                     'compute+result'
          9        ECHO                                                     '%0A'
   13    10        MUL                                              ~9      !0, 2
         11        FETCH_STATIC_PROP_W          unknown             $7      'inMemoryCache'
         12        ASSIGN_DIM                                               $7, !1
         13        OP_DATA                                                  ~9
   16    14    >   FETCH_STATIC_PROP_R          unknown             ~10     'inMemoryCache'
         15        FETCH_DIM_R                                      ~11     ~10, !1
         16      > RETURN                                                   ~11
   17    17*     > RETURN                                                   null

End of function testmethod

End of class Daughter.

Class Son:
Function testmethod:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 7, Position 2 = 14
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 14
filename:       /in/j03Dp
function name:  testMethod
number of ops:  18
compiled vars:  !0 = $param, !1 = $cacheKey
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    9     1        CONCAT                                           ~2      '_', !0
          2        ASSIGN                                                   !1, ~2
   11     3        FETCH_STATIC_PROP_IS                             ~4      'inMemoryCache'
          4        ISSET_ISEMPTY_DIM_OBJ                         0  ~5      ~4, !1
          5        BOOL_NOT                                         ~6      ~5
          6      > JMPZ                                                     ~6, ->14
   12     7    >   ECHO                                                     '%0A'
          8        ECHO                                                     'compute+result'
          9        ECHO                                                     '%0A'
   13    10        MUL                                              ~9      !0, 2
         11        FETCH_STATIC_PROP_W          unknown             $7      'inMemoryCache'
         12        ASSIGN_DIM                                               $7, !1
         13        OP_DATA                                                  ~9
   16    14    >   FETCH_STATIC_PROP_R          unknown             ~10     'inMemoryCache'
         15        FETCH_DIM_R                                      ~11     ~10, !1
         16      > RETURN                                                   ~11
   17    17*     > RETURN                                                   null

End of function testmethod

End of class Son.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
159.88 ms | 1403 KiB | 13 Q