3v4l.org

run code in 500+ PHP versions simultaneously
<?php class Foo { private $secretProperty = "Hello"; private function secretMethod() { return 'World'; } } $privatePropertyAccessor = function($prop) { return $this->$prop; }; $privateMethodAccessor = function($method) { return [$this, $method](); }; $foo = new Foo(); echo $privatePropertyAccessor->call($foo, 'secretProperty'); // Hello echo $privateMethodAccessor->call($foo, 'secretMethod'); // World
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/abZ3Y
function name:  (null)
number of ops:  18
compiled vars:  !0 = $privatePropertyAccessor, !1 = $privateMethodAccessor, !2 = $foo
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   11     0  E >   DECLARE_LAMBDA_FUNCTION                              ~3      [0]
          1        ASSIGN                                                       !0, ~3
   13     2        DECLARE_LAMBDA_FUNCTION                              ~5      [1]
          3        ASSIGN                                                       !1, ~5
   15     4        NEW                                                  $7      'Foo'
          5        DO_FCALL                                          0          
          6        ASSIGN                                                       !2, $7
   17     7        INIT_METHOD_CALL                                             !0, 'call'
          8        SEND_VAR_EX                                                  !2
          9        SEND_VAL_EX                                                  'secretProperty'
         10        DO_FCALL                                          0  $10     
         11        ECHO                                                         $10
   18    12        INIT_METHOD_CALL                                             !1, 'call'
         13        SEND_VAR_EX                                                  !2
         14        SEND_VAL_EX                                                  'secretMethod'
         15        DO_FCALL                                          0  $11     
         16        ECHO                                                         $11
         17      > 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/abZ3Y
function name:  {closure:/in/abZ3Y:11}
number of ops:  5
compiled vars:  !0 = $prop
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   11     0  E >   RECV                                                 !0      
          1        FETCH_THIS                                           $1      
          2        FETCH_OBJ_R                                          ~2      $1, !0
          3      > RETURN                                                       ~2
          4*     > RETURN                                                       null

End of Dynamic Function 0

Dynamic Function 1
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/abZ3Y
function name:  {closure:/in/abZ3Y:13}
number of ops:  8
compiled vars:  !0 = $method
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   13     0  E >   RECV                                                 !0      
          1        FETCH_THIS                                           ~1      
          2        INIT_ARRAY                                           ~2      ~1
          3        ADD_ARRAY_ELEMENT                                    ~2      !0
          4        INIT_DYNAMIC_CALL                                            ~2
          5        DO_FCALL                                          0  $3      
          6      > RETURN                                                       $3
          7*     > RETURN                                                       null

End of Dynamic Function 1

Class Foo:
Function secretmethod:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/abZ3Y
function name:  secretMethod
number of ops:  2
compiled vars:  none
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    7     0  E > > RETURN                                                       'World'
    8     1*     > RETURN                                                       null

End of function secretmethod

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
168.24 ms | 2919 KiB | 13 Q