3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test { public $foo = 10; protected $bar = 12; private $meh = 14; /** * @param string $key * @return boolean */ public function offsetExists($key) { return isset($this->{$key}); } /** * @param string $key * @return boolean */ public function offsetGet($key) { return method_exists($this, 'get'. ucfirst($key)) ? $this->{'get'. ucfirst($key)} : $this->{$key}; } /** * @param string $key * @param mixed $value */ public function offsetSet($key, $value) { method_exists($this, 'set'. ucfirst($key)) ? $this->{'set'. ucfirst($key)}($value) : $this->{$key} = $value; } /** * @param string $key */ public function offsetUnset($key) { unset($this->{$key}); } } $test = new Test; var_dump(get_object_vars($test)); foreach($test as $param) { echo $param; }
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 10, Position 2 = 13
Branch analysis from position: 10
2 jumps found. (Code = 78) Position 1 = 11, Position 2 = 13
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 13
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 13
filename:       /in/47vjU
function name:  (null)
number of ops:  15
compiled vars:  !0 = $test, !1 = $param
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   46     0  E >   NEW                                              $2      'Test'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   47     3        INIT_FCALL                                               'var_dump'
          4        INIT_FCALL                                               'get_object_vars'
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $5      
          7        SEND_VAR                                                 $5
          8        DO_ICALL                                                 
   49     9      > FE_RESET_R                                       $7      !0, ->13
         10    > > FE_FETCH_R                                               $7, !1, ->13
   51    11    >   ECHO                                                     !1
   49    12      > JMP                                                      ->10
         13    >   FE_FREE                                                  $7
   52    14      > RETURN                                                   1

Class Test:
Function offsetexists:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/47vjU
function name:  offsetExists
number of ops:  4
compiled vars:  !0 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   RECV                                             !0      
   15     1        ISSET_ISEMPTY_PROP_OBJ                           ~1      !0
          2      > RETURN                                                   ~1
   16     3*     > RETURN                                                   null

End of function offsetexists

Function offsetget:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 11, Position 2 = 18
Branch analysis from position: 11
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: 18
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/47vjU
function name:  offsetGet
number of ops:  22
compiled vars:  !0 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   22     0  E >   RECV                                             !0      
   24     1        INIT_FCALL                                               'method_exists'
          2        FETCH_THIS                                       ~1      
          3        SEND_VAL                                                 ~1
          4        INIT_FCALL                                               'ucfirst'
          5        SEND_VAR                                                 !0
          6        DO_ICALL                                         $2      
          7        CONCAT                                           ~3      'get', $2
          8        SEND_VAL                                                 ~3
          9        DO_ICALL                                         $4      
         10      > JMPZ                                                     $4, ->18
         11    >   INIT_FCALL                                               'ucfirst'
         12        SEND_VAR                                                 !0
         13        DO_ICALL                                         $5      
         14        CONCAT                                           ~6      'get', $5
         15        FETCH_OBJ_R                                      ~7      ~6
         16        QM_ASSIGN                                        ~8      ~7
         17      > JMP                                                      ->20
         18    >   FETCH_OBJ_R                                      ~9      !0
         19        QM_ASSIGN                                        ~8      ~9
         20    > > RETURN                                                   ~8
   25    21*     > RETURN                                                   null

End of function offsetget

Function offsetset:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 21
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 24
Branch analysis from position: 24
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/47vjU
function name:  offsetSet
number of ops:  26
compiled vars:  !0 = $key, !1 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   31     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   33     2        INIT_FCALL                                               'method_exists'
          3        FETCH_THIS                                       ~2      
          4        SEND_VAL                                                 ~2
          5        INIT_FCALL                                               'ucfirst'
          6        SEND_VAR                                                 !0
          7        DO_ICALL                                         $3      
          8        CONCAT                                           ~4      'set', $3
          9        SEND_VAL                                                 ~4
         10        DO_ICALL                                         $5      
         11      > JMPZ                                                     $5, ->21
         12    >   INIT_FCALL                                               'ucfirst'
         13        SEND_VAR                                                 !0
         14        DO_ICALL                                         $6      
         15        CONCAT                                           ~7      'set', $6
         16        INIT_METHOD_CALL                                         ~7
         17        SEND_VAR_EX                                              !1
         18        DO_FCALL                                      0  $8      
         19        QM_ASSIGN                                        ~9      $8
         20      > JMP                                                      ->24
         21    >   ASSIGN_OBJ                                       ~10     !0
         22        OP_DATA                                                  !1
         23        QM_ASSIGN                                        ~9      ~10
         24    >   FREE                                                     ~9
   34    25      > RETURN                                                   null

End of function offsetset

Function offsetunset:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/47vjU
function name:  offsetUnset
number of ops:  3
compiled vars:  !0 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   39     0  E >   RECV                                             !0      
   41     1        UNSET_OBJ                                                !0
   42     2      > RETURN                                                   null

End of function offsetunset

End of class Test.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.61 ms | 1404 KiB | 21 Q