3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Animal { protected $what = "nothing"; protected $born; public function __construct() { $this->born = time(); } function sound() { echo get_class($this)." says {$this->what}"; } function getBorn() { return $this->born; } } class Cow extends Animal { protected $what = "moo"; protected $owner; public function __construct($owner) { $this->owner = $owner; //must explicitly call parent::__construct to avoid wrong result; } } $a = new Cow("Old McDonald"); $a->sound(); echo "Cow was born on ",date("M j, Y",$a->getBorn());
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RQnd2
function name:  (null)
number of ops:  15
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   28     0  E >   NEW                                              $1      'Cow'
          1        SEND_VAL_EX                                              'Old+McDonald'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
   29     4        INIT_METHOD_CALL                                         !0, 'sound'
          5        DO_FCALL                                      0          
   30     6        ECHO                                                     'Cow+was+born+on+'
          7        INIT_FCALL                                               'date'
          8        SEND_VAL                                                 'M+j%2C+Y'
          9        INIT_METHOD_CALL                                         !0, 'getBorn'
         10        DO_FCALL                                      0  $5      
         11        SEND_VAR                                                 $5
         12        DO_ICALL                                         $6      
         13        ECHO                                                     $6
         14      > RETURN                                                   1

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

End of function sound

Function getborn:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RQnd2
function name:  getBorn
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   FETCH_OBJ_R                                      ~0      'born'
          1      > RETURN                                                   ~0
   16     2*     > RETURN                                                   null

End of function getborn

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/RQnd2
function name:  __construct
number of ops:  4
compiled vars:  !0 = $owner
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   RECV                                             !0      
   23     1        ASSIGN_OBJ                                               'owner'
          2        OP_DATA                                                  !0
   25     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/RQnd2
function name:  sound
number of ops:  8
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     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
   12     7      > RETURN                                                   null

End of function sound

Function getborn:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/RQnd2
function name:  getBorn
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   FETCH_OBJ_R                                      ~0      'born'
          1      > RETURN                                                   ~0
   16     2*     > RETURN                                                   null

End of function getborn

End of class Cow.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
164.14 ms | 1400 KiB | 17 Q