3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test { protected $id; public function __set($key, $value) { if (isset($this->$key)) $this->$key = $value; // throw new Exception() could be added here } public function __get($key) { return isset($this->$key) ? $this->$key : null; } public function __call($name, $arguments) { $matches = array(); $pattern = '/^set([A-Za-z0-9]+)/'; if (preg_match($pattern, $name, $matches)) { //var_dump($arguments, $matches); $method = strtolower($matches[1]); var_dump($method); $this->$method($arguments[0]); } } } $test = new Test; $test->setId(25); var_dump($test);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/lnQWW
function name:  (null)
number of ops:  10
compiled vars:  !0 = $test
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   32     0  E >   NEW                                              $1      'Test'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   33     3        INIT_METHOD_CALL                                         !0, 'setId'
          4        SEND_VAL_EX                                              25
          5        DO_FCALL                                      0          
   34     6        INIT_FCALL                                               'var_dump'
          7        SEND_VAR                                                 !0
          8        DO_ICALL                                                 
          9      > RETURN                                                   1

Class Test:
Function __set:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 6
Branch analysis from position: 4
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
filename:       /in/lnQWW
function name:  __set
number of ops:  7
compiled vars:  !0 = $key, !1 = $value
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    7     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    9     2        ISSET_ISEMPTY_PROP_OBJ                                   !0
          3      > JMPZ                                                     ~2, ->6
   10     4    >   ASSIGN_OBJ                                               !0
          5        OP_DATA                                                  !1
   12     6    > > RETURN                                                   null

End of function __set

Function __get:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 3, Position 2 = 6
Branch analysis from position: 3
1 jumps found. (Code = 42) Position 1 = 7
Branch analysis from position: 7
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 6
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/lnQWW
function name:  __get
number of ops:  9
compiled vars:  !0 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   RECV                                             !0      
   16     1        ISSET_ISEMPTY_PROP_OBJ                                   !0
          2      > JMPZ                                                     ~1, ->6
          3    >   FETCH_OBJ_R                                      ~2      !0
          4        QM_ASSIGN                                        ~3      ~2
          5      > JMP                                                      ->7
          6    >   QM_ASSIGN                                        ~3      null
          7    > > RETURN                                                   ~3
   17     8*     > RETURN                                                   null

End of function __get

Function __call:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 10, Position 2 = 23
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 23
filename:       /in/lnQWW
function name:  __call
number of ops:  24
compiled vars:  !0 = $name, !1 = $arguments, !2 = $matches, !3 = $pattern, !4 = $method
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   21     2        ASSIGN                                                   !2, <array>
   22     3        ASSIGN                                                   !3, '%2F%5Eset%28%5BA-Za-z0-9%5D%2B%29%2F'
   23     4        INIT_FCALL                                               'preg_match'
          5        SEND_VAR                                                 !3
          6        SEND_VAR                                                 !0
          7        SEND_REF                                                 !2
          8        DO_ICALL                                         $7      
          9      > JMPZ                                                     $7, ->23
   25    10    >   INIT_FCALL                                               'strtolower'
         11        FETCH_DIM_R                                      ~8      !2, 1
         12        SEND_VAL                                                 ~8
         13        DO_ICALL                                         $9      
         14        ASSIGN                                                   !4, $9
   26    15        INIT_FCALL                                               'var_dump'
         16        SEND_VAR                                                 !4
         17        DO_ICALL                                                 
   27    18        INIT_METHOD_CALL                                         !4
         19        CHECK_FUNC_ARG                                           
         20        FETCH_DIM_FUNC_ARG                               $12     !1, 0
         21        SEND_FUNC_ARG                                            $12
         22        DO_FCALL                                      0          
   29    23    > > RETURN                                                   null

End of function __call

End of class Test.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.32 ms | 1392 KiB | 19 Q