3v4l.org

run code in 300+ PHP versions simultaneously
<?php class User { public function __call($name, $value) { $type = substr($name, 0, 3); $variable = lcfirst(substr($name, 3)); if($type == 'get'){ return $this->$variable; } if($type == 'set'){ $this->$variable = $value[0]; return $this; } return call_user_func_array(array($this, $name), $value); } /*public function setEmail($email) { $trace=debug_backtrace(); $caller=array_shift($trace); echo "Called by {$caller['function']}"; if (isset($caller['class'])) { echo " in {$caller['class']}"; } $this->email = $email; return $this; }*/ } $user = new User(); $user->__call('setEmail', 'foo@bar.baz'); var_dump($user); $user->setEmail('foo2@bar.baz'); var_dump($user);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PZn2B
function name:  (null)
number of ops:  17
compiled vars:  !0 = $user
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   37     0  E >   NEW                                              $1      'User'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   39     3        INIT_METHOD_CALL                                         !0, '__call'
          4        SEND_VAL_EX                                              'setEmail'
          5        SEND_VAL_EX                                              'foo%40bar.baz'
          6        DO_FCALL                                      0          
   40     7        INIT_FCALL                                               'var_dump'
          8        SEND_VAR                                                 !0
          9        DO_ICALL                                                 
   41    10        INIT_METHOD_CALL                                         !0, 'setEmail'
         11        SEND_VAL_EX                                              'foo2%40bar.baz'
         12        DO_FCALL                                      0          
   42    13        INIT_FCALL                                               'var_dump'
         14        SEND_VAR                                                 !0
         15        DO_ICALL                                                 
         16      > RETURN                                                   1

Class User:
Function __call:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 20
Branch analysis from position: 18
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 20
2 jumps found. (Code = 43) Position 1 = 22, Position 2 = 27
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 27
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/PZn2B
function name:  __call
number of ops:  36
compiled vars:  !0 = $name, !1 = $value, !2 = $type, !3 = $variable
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    7     2        INIT_FCALL                                               'substr'
          3        SEND_VAR                                                 !0
          4        SEND_VAL                                                 0
          5        SEND_VAL                                                 3
          6        DO_ICALL                                         $4      
          7        ASSIGN                                                   !2, $4
    8     8        INIT_FCALL                                               'lcfirst'
          9        INIT_FCALL                                               'substr'
         10        SEND_VAR                                                 !0
         11        SEND_VAL                                                 3
         12        DO_ICALL                                         $6      
         13        SEND_VAR                                                 $6
         14        DO_ICALL                                         $7      
         15        ASSIGN                                                   !3, $7
   10    16        IS_EQUAL                                                 !2, 'get'
         17      > JMPZ                                                     ~9, ->20
   11    18    >   FETCH_OBJ_R                                      ~10     !3
         19      > RETURN                                                   ~10
   14    20    >   IS_EQUAL                                                 !2, 'set'
         21      > JMPZ                                                     ~11, ->27
   15    22    >   FETCH_DIM_R                                      ~13     !1, 0
         23        ASSIGN_OBJ                                               !3
         24        OP_DATA                                                  ~13
   16    25        FETCH_THIS                                       ~14     
         26      > RETURN                                                   ~14
   19    27    >   FETCH_THIS                                       ~15     
         28        INIT_ARRAY                                       ~16     ~15
         29        ADD_ARRAY_ELEMENT                                ~16     !0
         30        INIT_USER_CALL                                0          'call_user_func_array', ~16
         31        SEND_ARRAY                                               !1
         32        CHECK_UNDEF_ARGS                                         
         33        DO_FCALL                                      0  $17     
         34      > RETURN                                                   $17
   20    35*     > RETURN                                                   null

End of function __call

End of class User.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
152.31 ms | 1392 KiB | 19 Q