3v4l.org

run code in 300+ PHP versions simultaneously
<?php class myName{ protected $prop; public function __construct($value){ $this->prop = $value; } public function returnPrivate(){ return $this->prop; } } $oldObject = new myName('The named way'); echo $oldObject->returnPrivate()."\n"; class myNameExt extends myName{ public function returnPrivate(){ return $this->prop.' from named extension'; } } $extObject = new myNameExt('The named extension'); echo $extObject->returnPrivate()."\n"; $newObj = new class('The anonymous way') extends myName{ public function returnPrivate(){ return $this->prop.' with override'; } }; echo $newObj->returnPrivate();
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/G4NdJ
function name:  (null)
number of ops:  25
compiled vars:  !0 = $oldObject, !1 = $extObject, !2 = $newObj
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   NEW                                              $3      'myName'
          1        SEND_VAL_EX                                              'The+named+way'
          2        DO_FCALL                                      0          
          3        ASSIGN                                                   !0, $3
   22     4        INIT_METHOD_CALL                                         !0, 'returnPrivate'
          5        DO_FCALL                                      0  $6      
          6        CONCAT                                           ~7      $6, '%0A'
          7        ECHO                                                     ~7
   34     8        NEW                                              $8      'myNameExt'
          9        SEND_VAL_EX                                              'The+named+extension'
         10        DO_FCALL                                      0          
         11        ASSIGN                                                   !1, $8
   36    12        INIT_METHOD_CALL                                         !1, 'returnPrivate'
         13        DO_FCALL                                      0  $11     
         14        CONCAT                                           ~12     $11, '%0A'
         15        ECHO                                                     ~12
   38    16        DECLARE_ANON_CLASS                               'myName' 'myname'
         17        NEW                                              $14     $13
         18        SEND_VAL_EX                                              'The+anonymous+way'
         19        DO_FCALL                                      0          
         20        ASSIGN                                                   !2, $14
   48    21        INIT_METHOD_CALL                                         !2, 'returnPrivate'
         22        DO_FCALL                                      0  $17     
         23        ECHO                                                     $17
         24      > RETURN                                                   1

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

End of function __construct

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

End of function returnprivate

End of class myName.

Class myNameExt:
Function returnprivate:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/G4NdJ
function name:  returnPrivate
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   28     0  E >   FETCH_OBJ_R                                      ~0      'prop'
          1        CONCAT                                           ~1      ~0, '+from+named+extension'
          2      > RETURN                                                   ~1
   30     3*     > RETURN                                                   null

End of function returnprivate

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

End of function __construct

End of class myNameExt.

Class myName@anonymous:
Function returnprivate:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/G4NdJ
function name:  returnPrivate
number of ops:  4
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   42     0  E >   FETCH_OBJ_R                                      ~0      'prop'
          1        CONCAT                                           ~1      ~0, '+with+override'
          2      > RETURN                                                   ~1
   44     3*     > RETURN                                                   null

End of function returnprivate

End of class myName@anonymous.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
170.31 ms | 1399 KiB | 13 Q