3v4l.org

run code in 300+ PHP versions simultaneously
<?php class BaseItem { static protected $_instances = 0; private function __construct(){ echo 'Tworzymy obiekt podstawowy'.PHP_EOL; } public function doSomeConfig(){ echo 'Konfigurujemy obiekt '.((get_class($this) =='baseItem') ? 'podstawowy' : 'specjalny').'<br/>'; } public function work() { echo 'Ja dzialam: '.get_class($this).' '.PHP_EOL; } public static function factory() { $object = new BaseItem; $object->doSomeConfig(); self::$_instances++; return $object; } } class SpecialItem extends BaseItem { private function __construct(){ echo 'Tworzymy obiekt specjalny'.PHP_EOL; } public static function factory() { $object = new SpecialItem; $object->doSomeConfig(); parent::$_instances++; return $object; } } $baseObject = BaseItem::factory(); $specialObject = SpecialItem::factory(); $baseObject->work(); $specialObject->work();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jFA0G
function name:  (null)
number of ops:  11
compiled vars:  !0 = $baseObject, !1 = $specialObject
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   43     0  E >   INIT_STATIC_METHOD_CALL                                  'BaseItem', 'factory'
          1        DO_FCALL                                      0  $2      
          2        ASSIGN                                                   !0, $2
   44     3        INIT_STATIC_METHOD_CALL                                  'SpecialItem', 'factory'
          4        DO_FCALL                                      0  $4      
          5        ASSIGN                                                   !1, $4
   46     6        INIT_METHOD_CALL                                         !0, 'work'
          7        DO_FCALL                                      0          
   47     8        INIT_METHOD_CALL                                         !1, 'work'
          9        DO_FCALL                                      0          
         10      > RETURN                                                   1

Class BaseItem:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jFA0G
function name:  __construct
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   ECHO                                                     'Tworzymy+obiekt+podstawowy%0A'
    9     1      > RETURN                                                   null

End of function __construct

Function dosomeconfig:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 6
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jFA0G
function name:  doSomeConfig
number of ops:  11
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   FETCH_THIS                                       ~0      
          1        GET_CLASS                                        ~1      ~0
          2        IS_EQUAL                                                 ~1, 'baseItem'
          3      > JMPZ                                                     ~2, ->6
          4    >   QM_ASSIGN                                        ~3      'podstawowy'
          5      > JMP                                                      ->7
          6    >   QM_ASSIGN                                        ~3      'specjalny'
          7    >   CONCAT                                           ~4      'Konfigurujemy+obiekt+', ~3
          8        CONCAT                                           ~5      ~4, '%3Cbr%2F%3E'
          9        ECHO                                                     ~5
   13    10      > RETURN                                                   null

End of function dosomeconfig

Function work:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jFA0G
function name:  work
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   FETCH_THIS                                       ~0      
          1        GET_CLASS                                        ~1      ~0
          2        CONCAT                                           ~2      'Ja+dzialam%3A+', ~1
          3        CONCAT                                           ~3      ~2, '+'
          4        CONCAT                                           ~4      ~3, '%0A'
          5        ECHO                                                     ~4
   17     6      > RETURN                                                   null

End of function work

Function factory:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jFA0G
function name:  factory
number of ops:  8
compiled vars:  !0 = $object
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   NEW                                              $1      'BaseItem'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   21     3        INIT_METHOD_CALL                                         !0, 'doSomeConfig'
          4        DO_FCALL                                      0          
   22     5        PRE_INC_STATIC_PROP                                      '_instances'
   24     6      > RETURN                                                   !0
   25     7*     > RETURN                                                   null

End of function factory

End of class BaseItem.

Class SpecialItem:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jFA0G
function name:  __construct
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   31     0  E >   ECHO                                                     'Tworzymy+obiekt+specjalny%0A'
   32     1      > RETURN                                                   null

End of function __construct

Function factory:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jFA0G
function name:  factory
number of ops:  8
compiled vars:  !0 = $object
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   35     0  E >   NEW                                              $1      'SpecialItem'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   36     3        INIT_METHOD_CALL                                         !0, 'doSomeConfig'
          4        DO_FCALL                                      0          
   37     5        PRE_INC_STATIC_PROP                                      '_instances'
   39     6      > RETURN                                                   !0
   40     7*     > RETURN                                                   null

End of function factory

Function dosomeconfig:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 6
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jFA0G
function name:  doSomeConfig
number of ops:  11
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   12     0  E >   FETCH_THIS                                       ~0      
          1        GET_CLASS                                        ~1      ~0
          2        IS_EQUAL                                                 ~1, 'baseItem'
          3      > JMPZ                                                     ~2, ->6
          4    >   QM_ASSIGN                                        ~3      'podstawowy'
          5      > JMP                                                      ->7
          6    >   QM_ASSIGN                                        ~3      'specjalny'
          7    >   CONCAT                                           ~4      'Konfigurujemy+obiekt+', ~3
          8        CONCAT                                           ~5      ~4, '%3Cbr%2F%3E'
          9        ECHO                                                     ~5
   13    10      > RETURN                                                   null

End of function dosomeconfig

Function work:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/jFA0G
function name:  work
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   16     0  E >   FETCH_THIS                                       ~0      
          1        GET_CLASS                                        ~1      ~0
          2        CONCAT                                           ~2      'Ja+dzialam%3A+', ~1
          3        CONCAT                                           ~3      ~2, '+'
          4        CONCAT                                           ~4      ~3, '%0A'
          5        ECHO                                                     ~4
   17     6      > RETURN                                                   null

End of function work

End of class SpecialItem.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
171.79 ms | 1407 KiB | 13 Q