3v4l.org

run code in 500+ PHP versions simultaneously
<?php class Foo { private $bar; public function __construct() { unset($this->bar); } public function __isset($name) { var_dump(__METHOD__); return true; } public function __get($name) { var_dump(__METHOD__); return $name; } } $instance = new Foo(); $reflectionBar = (new ReflectionProperty(Foo::class, 'bar')); $reflectionBar->setAccessible(true); $closureBar = (function (Foo $instance) { return $instance->bar; })->bindTo(null, Foo::class); var_dump($reflectionBar->getValue($instance)); var_dump($closureBar($instance));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9BipO
function name:  (null)
number of ops:  30
compiled vars:  !0 = $instance, !1 = $reflectionBar, !2 = $closureBar
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   27     0  E >   NEW                                                  $3      'Foo'
          1        DO_FCALL                                          0          
          2        ASSIGN                                                       !0, $3
   29     3        NEW                                                  $6      'ReflectionProperty'
          4        SEND_VAL_EX                                                  'Foo'
          5        SEND_VAL_EX                                                  'bar'
          6        DO_FCALL                                          0          
          7        ASSIGN                                                       !1, $6
   30     8        INIT_METHOD_CALL                                             !1, 'setAccessible'
          9        SEND_VAL_EX                                                  <true>
         10        DO_FCALL                                          0          
   31    11        DECLARE_LAMBDA_FUNCTION                              ~10     [0]
   33    12        INIT_METHOD_CALL                                             ~10, 'bindTo'
         13        SEND_VAL_EX                                                  null
         14        SEND_VAL_EX                                                  'Foo'
         15        DO_FCALL                                          0  $11     
   31    16        ASSIGN                                                       !2, $11
   35    17        INIT_FCALL                                                   'var_dump'
         18        INIT_METHOD_CALL                                             !1, 'getValue'
         19        SEND_VAR_EX                                                  !0
         20        DO_FCALL                                          0  $13     
         21        SEND_VAR                                                     $13
         22        DO_ICALL                                                     
   36    23        INIT_FCALL                                                   'var_dump'
         24        INIT_DYNAMIC_CALL                                            !2
         25        SEND_VAR_EX                                                  !0
         26        DO_FCALL                                          0  $15     
         27        SEND_VAR                                                     $15
         28        DO_ICALL                                                     
         29      > 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/9BipO
function name:  {closure:/in/9BipO:31}
number of ops:  4
compiled vars:  !0 = $instance
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   31     0  E >   RECV                                                 !0      
   32     1        FETCH_OBJ_R                                          ~1      !0, 'bar'
          2      > RETURN                                                       ~1
   33     3*     > RETURN                                                       null

End of Dynamic Function 0

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

End of function __construct

Function __isset:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9BipO
function name:  __isset
number of ops:  6
compiled vars:  !0 = $name
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   12     0  E >   RECV                                                 !0      
   14     1        INIT_FCALL                                                   'var_dump'
          2        SEND_VAL                                                     'Foo%3A%3A__isset'
          3        DO_ICALL                                                     
   16     4      > RETURN                                                       <true>
   17     5*     > RETURN                                                       null

End of function __isset

Function __get:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/9BipO
function name:  __get
number of ops:  6
compiled vars:  !0 = $name
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   19     0  E >   RECV                                                 !0      
   21     1        INIT_FCALL                                                   'var_dump'
          2        SEND_VAL                                                     'Foo%3A%3A__get'
          3        DO_ICALL                                                     
   23     4      > RETURN                                                       !0
   24     5*     > RETURN                                                       null

End of function __get

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
161.58 ms | 2723 KiB | 14 Q