3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo { protected $id; protected $text; public function __get($name) { $methodName = 'get' . ucfirst($name); return method_exists($this, $methodName) ? $this->{$methodName}() : $this->{$name}; } public function __set($name, $value) { $methodName = 'set' . ucfirst($name); return method_exists($this, $methodName) ? $this->{$methodName}($value) : $this->{$name} = $value; } public function __isset($name) { return property_exists($this, $name); } public function setText($text) { $this->text = $text . ' World!'; } } $foo = new Foo(); $foo->id = 1; $foo->text = 'Hello'; echo $foo->id; // 1 echo $foo->text; // Hello World!
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UIqnK
function name:  (null)
number of ops:  12
compiled vars:  !0 = $foo
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   30     0  E >   NEW                                              $1      'Foo'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   32     3        ASSIGN_OBJ                                               !0, 'id'
          4        OP_DATA                                                  1
   33     5        ASSIGN_OBJ                                               !0, 'text'
          6        OP_DATA                                                  'Hello'
   35     7        FETCH_OBJ_R                                      ~6      !0, 'id'
          8        ECHO                                                     ~6
   36     9        FETCH_OBJ_R                                      ~7      !0, 'text'
         10        ECHO                                                     ~7
         11      > RETURN                                                   1

Class Foo:
Function __get:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 12, Position 2 = 16
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 18
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 16
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UIqnK
function name:  __get
number of ops:  20
compiled vars:  !0 = $name, !1 = $methodName
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
    9     1        INIT_FCALL                                               'ucfirst'
          2        SEND_VAR                                                 !0
          3        DO_ICALL                                         $2      
          4        CONCAT                                           ~3      'get', $2
          5        ASSIGN                                                   !1, ~3
   10     6        INIT_FCALL                                               'method_exists'
          7        FETCH_THIS                                       ~5      
          8        SEND_VAL                                                 ~5
          9        SEND_VAR                                                 !1
         10        DO_ICALL                                         $6      
         11      > JMPZ                                                     $6, ->16
         12    >   INIT_METHOD_CALL                                         !1
         13        DO_FCALL                                      0  $7      
         14        QM_ASSIGN                                        ~8      $7
         15      > JMP                                                      ->18
         16    >   FETCH_OBJ_R                                      ~9      !0
         17        QM_ASSIGN                                        ~8      ~9
         18    > > RETURN                                                   ~8
   11    19*     > RETURN                                                   null

End of function __get

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

End of function __set

Function __isset:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UIqnK
function name:  __isset
number of ops:  8
compiled vars:  !0 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   RECV                                             !0      
   21     1        INIT_FCALL                                               'property_exists'
          2        FETCH_THIS                                       ~1      
          3        SEND_VAL                                                 ~1
          4        SEND_VAR                                                 !0
          5        DO_ICALL                                         $2      
          6      > RETURN                                                   $2
   22     7*     > RETURN                                                   null

End of function __isset

Function settext:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/UIqnK
function name:  setText
number of ops:  5
compiled vars:  !0 = $text
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   24     0  E >   RECV                                             !0      
   26     1        CONCAT                                           ~2      !0, '+World%21'
          2        ASSIGN_OBJ                                               'text'
          3        OP_DATA                                                  ~2
   27     4      > RETURN                                                   null

End of function settext

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
148.86 ms | 1400 KiB | 19 Q