3v4l.org

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

Class myName:
Function __construct:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/NMVNd
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/NMVNd
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 myName@anonymous:
Function returnprivate:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/NMVNd
function name:  returnPrivate
number of ops:  4
compiled vars:  !0 = $propName
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   29     0  E >   FETCH_OBJ_R                                      ~1      !0
          1        CONCAT                                           ~2      ~1, '+with+override'
          2      > RETURN                                                   ~2
   31     3*     > RETURN                                                   null

End of function returnprivate

End of class myName@anonymous.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
160.97 ms | 1395 KiB | 13 Q