3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Animal { protected $what = "nothing"; protected $born; function sound() { echo get_class($this)." says {$this->what}"; } public function __construct() { $this->born = time(); } } class Cow extends Animal { protected $what = "moo"; protected $owner; public function __construct($owner) { $this->owner = $owner; // parent::__construct(); (?) } } $a = new Cow("Old McDonald"); $a->sound();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/XQWtV
function name:  (null)
number of ops:  7
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   24     0  E >   NEW                                              $1      'Cow'
          1        SEND_VAL_EX                                              'Old+McDonald'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
   25     4        INIT_METHOD_CALL                                         !0, 'sound'
          5        DO_FCALL                                      0          
          6      > RETURN                                                   1

Class Animal:
Function sound:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/XQWtV
function name:  sound
number of ops:  8
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   FETCH_THIS                                       ~0      
          1        GET_CLASS                                        ~1      ~0
          2        NOP                                                      
          3        FETCH_OBJ_R                                      ~2      'what'
          4        FAST_CONCAT                                      ~3      '+says+', ~2
          5        CONCAT                                           ~4      ~1, ~3
          6        ECHO                                                     ~4
    8     7      > RETURN                                                   null

End of function sound

Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/XQWtV
function name:  __construct
number of ops:  5
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   INIT_FCALL                                               'time'
          1        DO_ICALL                                         $1      
          2        ASSIGN_OBJ                                               'born'
          3        OP_DATA                                                  $1
   12     4      > RETURN                                                   null

End of function __construct

End of class Animal.

Class Cow:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/XQWtV
function name:  __construct
number of ops:  4
compiled vars:  !0 = $owner
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   RECV                                             !0      
   19     1        ASSIGN_OBJ                                               'owner'
          2        OP_DATA                                                  !0
   21     3      > RETURN                                                   null

End of function __construct

Function sound:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/XQWtV
function name:  sound
number of ops:  8
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   FETCH_THIS                                       ~0      
          1        GET_CLASS                                        ~1      ~0
          2        NOP                                                      
          3        FETCH_OBJ_R                                      ~2      'what'
          4        FAST_CONCAT                                      ~3      '+says+', ~2
          5        CONCAT                                           ~4      ~1, ~3
          6        ECHO                                                     ~4
    8     7      > RETURN                                                   null

End of function sound

End of class Cow.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
133.18 ms | 1405 KiB | 15 Q