3v4l.org

run code in 300+ PHP versions simultaneously
<?php interface Cachable { public function getCacheTtl(): int; } abstract class AbstractCacheItem implements Cachable { private $config = []; public function getCacheTtl(): int { return $this->config['cache_ttl'] ?? defined('static::CACHE_TTL') ? constant('static::CACHE_TTL') : 60; } } class SomeCacheItemA extends AbstractCacheItem { public const CACHE_TTL = 61; } class SomeCacheItemB extends AbstractCacheItem { } $a = new SomeCacheItemA(); $b = new SomeCacheItemB(); var_dump($a->getCacheTtl(), $b->getCacheTtl());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GvfnC
function name:  (null)
number of ops:  18
compiled vars:  !0 = $a, !1 = $b
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   DECLARE_CLASS                                            'abstractcacheitem'
   21     1        DECLARE_CLASS                                            'somecacheitema', 'abstractcacheitem'
   26     2        DECLARE_CLASS                                            'somecacheitemb', 'abstractcacheitem'
   30     3        NEW                                              $2      'SomeCacheItemA'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !0, $2
   31     6        NEW                                              $5      'SomeCacheItemB'
          7        DO_FCALL                                      0          
          8        ASSIGN                                                   !1, $5
   33     9        INIT_FCALL                                               'var_dump'
         10        INIT_METHOD_CALL                                         !0, 'getCacheTtl'
         11        DO_FCALL                                      0  $8      
         12        SEND_VAR                                                 $8
         13        INIT_METHOD_CALL                                         !1, 'getCacheTtl'
         14        DO_FCALL                                      0  $9      
         15        SEND_VAR                                                 $9
         16        DO_ICALL                                                 
         17      > RETURN                                                   1

Class Cachable:
Function getcachettl:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GvfnC
function name:  getCacheTtl
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   VERIFY_RETURN_TYPE                                       
          1      > RETURN                                                   null

End of function getcachettl

End of class Cachable.

Class AbstractCacheItem:
Function getcachettl:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 8, Position 2 = 13
Branch analysis from position: 8
1 jumps found. (Code = 42) Position 1 = 14
Branch analysis from position: 14
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/GvfnC
function name:  getCacheTtl
number of ops:  18
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   FETCH_OBJ_IS                                     ~0      'config'
          1        FETCH_DIM_IS                                     ~1      ~0, 'cache_ttl'
          2        COALESCE                                         ~2      ~1
   15     3        INIT_FCALL                                               'defined'
          4        SEND_VAL                                                 'static%3A%3ACACHE_TTL'
          5        DO_ICALL                                         $3      
          6        QM_ASSIGN                                        ~2      $3
          7      > JMPZ                                                     ~2, ->13
   16     8    >   INIT_FCALL                                               'constant'
          9        SEND_VAL                                                 'static%3A%3ACACHE_TTL'
         10        DO_ICALL                                         $4      
         11        QM_ASSIGN                                        ~5      $4
         12      > JMP                                                      ->14
   17    13    >   QM_ASSIGN                                        ~5      60
         14    >   VERIFY_RETURN_TYPE                                       ~5
         15      > RETURN                                                   ~5
   18    16*       VERIFY_RETURN_TYPE                                       
         17*     > RETURN                                                   null

End of function getcachettl

End of class AbstractCacheItem.

Class SomeCacheItemA: [no user functions]
Class SomeCacheItemB: [no user functions]

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
171.35 ms | 1400 KiB | 19 Q