3v4l.org

run code in 300+ 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 echo ((array) $foo)['secretProperty'];
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Wd4l7
function name:  (null)
number of ops:  21
compiled vars:  !0 = $privatePropertyAccessor, !1 = $privateMethodAccessor, !2 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   11     0  E >   DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FWd4l7%3A11%240'
          1        ASSIGN                                                   !0, ~3
   13     2        DECLARE_LAMBDA_FUNCTION                                  '%00%7Bclosure%7D%2Fin%2FWd4l7%3A13%241'
          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
   19    17        CAST                                          7  ~12     !2
         18        FETCH_DIM_R                                      ~13     ~12, 'secretProperty'
         19        ECHO                                                     ~13
         20      > RETURN                                                   1

Function %00%7Bclosure%7D%2Fin%2FWd4l7%3A11%240:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Wd4l7
function name:  {closure}
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 function %00%7Bclosure%7D%2Fin%2FWd4l7%3A11%240

Function %00%7Bclosure%7D%2Fin%2FWd4l7%3A13%241:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Wd4l7
function name:  {closure}
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 function %00%7Bclosure%7D%2Fin%2FWd4l7%3A13%241

Class Foo:
Function secretmethod:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/Wd4l7
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.0.0


preferences:
154.21 ms | 1399 KiB | 13 Q