3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foobar { private $foo = 'start'; public function getFoo() { return $this->foo; } public function unsetFoo() { unset($this->foo); } public function __get($ppt) { $this->$ppt = 'magic'; return $this->$ppt; } } function display_visibility($object, $attr) { $r = new ReflectionProperty($object, $attr); switch (true) { case $r->isPublic(): return 'public'; case $r->isProtected(): return 'protected'; case $r->isPrivate(): return 'private'; } } $o = new Foobar(); var_dump($o->getFoo()); var_dump(display_visibility($o, 'foo')); $o->unsetFoo(); var_dump($o->getFoo()); var_dump(display_visibility($o, 'foo'));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/kf1v4
function name:  (null)
number of ops:  30
compiled vars:  !0 = $o
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   39     0  E >   NEW                                              $1      'Foobar'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   40     3        INIT_FCALL                                               'var_dump'
          4        INIT_METHOD_CALL                                         !0, 'getFoo'
          5        DO_FCALL                                      0  $4      
          6        SEND_VAR                                                 $4
          7        DO_ICALL                                                 
   41     8        INIT_FCALL                                               'var_dump'
          9        INIT_FCALL                                               'display_visibility'
         10        SEND_VAR                                                 !0
         11        SEND_VAL                                                 'foo'
         12        DO_FCALL                                      0  $6      
         13        SEND_VAR                                                 $6
         14        DO_ICALL                                                 
   42    15        INIT_METHOD_CALL                                         !0, 'unsetFoo'
         16        DO_FCALL                                      0          
   43    17        INIT_FCALL                                               'var_dump'
         18        INIT_METHOD_CALL                                         !0, 'getFoo'
         19        DO_FCALL                                      0  $9      
         20        SEND_VAR                                                 $9
         21        DO_ICALL                                                 
   44    22        INIT_FCALL                                               'var_dump'
         23        INIT_FCALL                                               'display_visibility'
         24        SEND_VAR                                                 !0
         25        SEND_VAL                                                 'foo'
         26        DO_FCALL                                      0  $11     
         27        SEND_VAR                                                 $11
         28        DO_ICALL                                                 
         29      > RETURN                                                   1

Function display_visibility:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 44) Position 1 = 10, Position 2 = 17
Branch analysis from position: 10
2 jumps found. (Code = 44) Position 1 = 13, Position 2 = 18
Branch analysis from position: 13
2 jumps found. (Code = 44) Position 1 = 16, Position 2 = 19
Branch analysis from position: 16
1 jumps found. (Code = 42) Position 1 = 20
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/kf1v4
function name:  display_visibility
number of ops:  21
compiled vars:  !0 = $object, !1 = $attr, !2 = $r
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   27     2        NEW                                              $3      'ReflectionProperty'
          3        SEND_VAR_EX                                              !0
          4        SEND_VAR_EX                                              !1
          5        DO_FCALL                                      0          
          6        ASSIGN                                                   !2, $3
   30     7        INIT_METHOD_CALL                                         !2, 'isPublic'
          8        DO_FCALL                                      0  $7      
          9      > JMPNZ                                                    $7, ->17
   32    10    >   INIT_METHOD_CALL                                         !2, 'isProtected'
         11        DO_FCALL                                      0  $8      
         12      > JMPNZ                                                    $8, ->18
   34    13    >   INIT_METHOD_CALL                                         !2, 'isPrivate'
         14        DO_FCALL                                      0  $9      
         15      > JMPNZ                                                    $9, ->19
         16    > > JMP                                                      ->20
   31    17    > > RETURN                                                   'public'
   33    18    > > RETURN                                                   'protected'
   35    19    > > RETURN                                                   'private'
   37    20    > > RETURN                                                   null

End of function display_visibility

Class Foobar:
Function getfoo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/kf1v4
function name:  getFoo
number of ops:  3
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   FETCH_OBJ_R                                      ~0      'foo'
          1      > RETURN                                                   ~0
   10     2*     > RETURN                                                   null

End of function getfoo

Function unsetfoo:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/kf1v4
function name:  unsetFoo
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   UNSET_OBJ                                                'foo'
   15     1      > RETURN                                                   null

End of function unsetfoo

Function __get:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/kf1v4
function name:  __get
number of ops:  6
compiled vars:  !0 = $ppt
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   17     0  E >   RECV                                             !0      
   19     1        ASSIGN_OBJ                                               !0
          2        OP_DATA                                                  'magic'
   21     3        FETCH_OBJ_R                                      ~2      !0
          4      > RETURN                                                   ~2
   22     5*     > RETURN                                                   null

End of function __get

End of class Foobar.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.94 ms | 1403 KiB | 17 Q