3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Pet { protected $_name; protected $_status = 'None'; protected $_petLocation = 'who knows'; // Want to replace this function public function playing($game = 'ball') { $this->_status = $this->_type . ' is playing ' . $game; return '<br>' . $this->_name . ' started to play a ' . $game; } public function getPetStatus() { return '<br>Status: ' . $this->_status; } } class Cat extends Pet { function __construct() { $this->_type = 'Cat'; echo 'Test: The ' . $this->_type . ' was born '; } // Replacing with this one public function playing($gameType = 'chess', $location = 'backyard') { $this->_status = 'playing ' . $gameType . ' in the ' . $location; return '<br>' . $this->_type . ' started to play a ' . $gameType . ' in the ' . $location; } } $cat = new Cat('Billy'); echo $cat->getPetStatus(); echo $cat->playing(); echo $cat->getPetStatus();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Dm27r
function name:  (null)
number of ops:  14
compiled vars:  !0 = $cat
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   34     0  E >   NEW                                              $1      'Cat'
          1        SEND_VAL_EX                                              'Billy'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $1
   35     4        INIT_METHOD_CALL                                         !0, 'getPetStatus'
          5        DO_FCALL                                      0  $4      
          6        ECHO                                                     $4
   36     7        INIT_METHOD_CALL                                         !0, 'playing'
          8        DO_FCALL                                      0  $5      
          9        ECHO                                                     $5
   37    10        INIT_METHOD_CALL                                         !0, 'getPetStatus'
         11        DO_FCALL                                      0  $6      
         12        ECHO                                                     $6
         13      > RETURN                                                   1

Class Pet:
Function playing:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Dm27r
function name:  playing
number of ops:  12
compiled vars:  !0 = $game
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV_INIT                                        !0      'ball'
   10     1        FETCH_OBJ_R                                      ~2      '_type'
          2        CONCAT                                           ~3      ~2, '+is+playing+'
          3        CONCAT                                           ~4      ~3, !0
          4        ASSIGN_OBJ                                               '_status'
          5        OP_DATA                                                  ~4
   11     6        FETCH_OBJ_R                                      ~5      '_name'
          7        CONCAT                                           ~6      '%3Cbr%3E', ~5
          8        CONCAT                                           ~7      ~6, '+started+to+play+a+'
          9        CONCAT                                           ~8      ~7, !0
         10      > RETURN                                                   ~8
   12    11*     > RETURN                                                   null

End of function playing

Function getpetstatus:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Dm27r
function name:  getPetStatus
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   FETCH_OBJ_R                                      ~0      '_status'
          1        CONCAT                                           ~1      '%3Cbr%3EStatus%3A+', ~0
          2      > RETURN                                                   ~1
   16     3*     > RETURN                                                   null

End of function getpetstatus

End of class Pet.

Class Cat:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Dm27r
function name:  __construct
number of ops:  7
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   23     0  E >   ASSIGN_OBJ                                               '_type'
          1        OP_DATA                                                  'Cat'
   24     2        FETCH_OBJ_R                                      ~1      '_type'
          3        CONCAT                                           ~2      'Test%3A+The+', ~1
          4        CONCAT                                           ~3      ~2, '+was+born+'
          5        ECHO                                                     ~3
   25     6      > RETURN                                                   null

End of function __construct

Function playing:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Dm27r
function name:  playing
number of ops:  15
compiled vars:  !0 = $gameType, !1 = $location
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   28     0  E >   RECV_INIT                                        !0      'chess'
          1        RECV_INIT                                        !1      'backyard'
   29     2        CONCAT                                           ~3      'playing+', !0
          3        CONCAT                                           ~4      ~3, '+in+the+'
          4        CONCAT                                           ~5      ~4, !1
          5        ASSIGN_OBJ                                               '_status'
          6        OP_DATA                                                  ~5
   30     7        FETCH_OBJ_R                                      ~6      '_type'
          8        CONCAT                                           ~7      '%3Cbr%3E', ~6
          9        CONCAT                                           ~8      ~7, '+started+to+play+a+'
         10        CONCAT                                           ~9      ~8, !0
         11        CONCAT                                           ~10     ~9, '+in+the+'
         12        CONCAT                                           ~11     ~10, !1
         13      > RETURN                                                   ~11
   31    14*     > RETURN                                                   null

End of function playing

Function getpetstatus:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Dm27r
function name:  getPetStatus
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   15     0  E >   FETCH_OBJ_R                                      ~0      '_status'
          1        CONCAT                                           ~1      '%3Cbr%3EStatus%3A+', ~0
          2      > RETURN                                                   ~1
   16     3*     > RETURN                                                   null

End of function getpetstatus

End of class Cat.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.38 ms | 1399 KiB | 13 Q