3v4l.org

run code in 500+ PHP versions simultaneously
<?php class A{ private $item = 5; public function getItem(){ return $this->item; } } $obj = new A(); echo $obj->getItem()."\n"; $obj->getItem = function(){return 10;}; echo $obj->getItem()."\n"; $fun = $obj->getItem; echo $fun()."\n";
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HRe8Q
function name:  (null)
number of ops:  21
compiled vars:  !0 = $obj, !1 = $fun
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   12     0  E >   NEW                                                  $2      'A'
          1        DO_FCALL                                          0          
          2        ASSIGN                                                       !0, $2
   14     3        INIT_METHOD_CALL                                             !0, 'getItem'
          4        DO_FCALL                                          0  $5      
          5        CONCAT                                               ~6      $5, '%0A'
          6        ECHO                                                         ~6
   16     7        DECLARE_LAMBDA_FUNCTION                              ~8      [0]
          8        ASSIGN_OBJ                                                   !0, 'getItem'
          9        OP_DATA                                                      ~8
   18    10        INIT_METHOD_CALL                                             !0, 'getItem'
         11        DO_FCALL                                          0  $9      
         12        CONCAT                                               ~10     $9, '%0A'
         13        ECHO                                                         ~10
   20    14        FETCH_OBJ_R                                          ~11     !0, 'getItem'
         15        ASSIGN                                                       !1, ~11
   22    16        INIT_DYNAMIC_CALL                                            !1
         17        DO_FCALL                                          0  $13     
         18        CONCAT                                               ~14     $13, '%0A'
         19        ECHO                                                         ~14
         20      > RETURN                                                       1


Dynamic Functions:
Dynamic Function 0
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HRe8Q
function name:  {closure:/in/HRe8Q:16}
number of ops:  2
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   16     0  E > > RETURN                                                       10
          1*     > RETURN                                                       null

End of Dynamic Function 0

Class A:
Function getitem:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/HRe8Q
function name:  getItem
number of ops:  3
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    7     0  E >   FETCH_OBJ_R                                          ~0      'item'
          1      > RETURN                                                       ~0
    8     2*     > RETURN                                                       null

End of function getitem

End of class A.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
167.18 ms | 2024 KiB | 13 Q