3v4l.org

run code in 300+ PHP versions simultaneously
<?php class stdObject{ public function __construct(array $params=array()){ if(!empty($params)) foreach ($params as $key => $value) $this->{$key}=$value; } public function __call($methodName,$params){ $params=array_merge(array('stdObject'=>$this),$params); if(isset($this->{$methodName})&&is_callable($this->$methodName)){ //$params就是函数的参数,这里的stdObject就是function中的$stdObject; return call_user_func_array($methodName,$params); } else { throw new Exception("Fatal error: Call to undefined method stdObject::{$methodName}()"); } } } echo phpversion(); $obj = new stdObject(); $obj->name = "Nick"; $obj->surname = "Doe"; $obj->age = 20; $obj->adresse = null; var_dump($obj); ?>
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/MStjS
function name:  (null)
number of ops:  18
compiled vars:  !0 = $obj
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E >   INIT_FCALL                                               'phpversion'
          1        DO_ICALL                                         $1      
          2        ECHO                                                     $1
   22     3        NEW                                              $2      'stdObject'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !0, $2
   23     6        ASSIGN_OBJ                                               !0, 'name'
          7        OP_DATA                                                  'Nick'
   24     8        ASSIGN_OBJ                                               !0, 'surname'
          9        OP_DATA                                                  'Doe'
   25    10        ASSIGN_OBJ                                               !0, 'age'
         11        OP_DATA                                                  20
   26    12        ASSIGN_OBJ                                               !0, 'adresse'
         13        OP_DATA                                                  null
   27    14        INIT_FCALL                                               'var_dump'
         15        SEND_VAR                                                 !0
         16        DO_ICALL                                                 
   28    17      > RETURN                                                   1

Class stdObject:
Function __construct:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 4, Position 2 = 11
Branch analysis from position: 4
2 jumps found. (Code = 77) Position 1 = 5, Position 2 = 10
Branch analysis from position: 5
2 jumps found. (Code = 78) Position 1 = 6, Position 2 = 10
Branch analysis from position: 6
1 jumps found. (Code = 42) Position 1 = 5
Branch analysis from position: 5
Branch analysis from position: 10
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 10
Branch analysis from position: 11
filename:       /in/MStjS
function name:  __construct
number of ops:  12
compiled vars:  !0 = $params, !1 = $value, !2 = $key
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV_INIT                                        !0      <array>
    4     1        ISSET_ISEMPTY_CV                                 ~3      !0
          2        BOOL_NOT                                         ~4      ~3
          3      > JMPZ                                                     ~4, ->11
    5     4    > > FE_RESET_R                                       $5      !0, ->10
          5    > > FE_FETCH_R                                       ~6      $5, !1, ->10
          6    >   ASSIGN                                                   !2, ~6
    6     7        ASSIGN_OBJ                                               !2
          8        OP_DATA                                                  !1
    5     9      > JMP                                                      ->5
         10    >   FE_FREE                                                  $5
    7    11    > > RETURN                                                   null

End of function __construct

Function __call:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 46) Position 1 = 11, Position 2 = 16
Branch analysis from position: 11
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 23
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 23
1 jumps found. (Code = 108) Position 1 = -2
Branch analysis from position: 16
filename:       /in/MStjS
function name:  __call
number of ops:  31
compiled vars:  !0 = $methodName, !1 = $params
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   10     2        INIT_FCALL                                               'array_merge'
          3        FETCH_THIS                                       ~2      
          4        INIT_ARRAY                                       ~3      ~2, 'stdObject'
          5        SEND_VAL                                                 ~3
          6        SEND_VAR                                                 !1
          7        DO_ICALL                                         $4      
          8        ASSIGN                                                   !1, $4
   11     9        ISSET_ISEMPTY_PROP_OBJ                           ~6      !0
         10      > JMPZ_EX                                          ~6      ~6, ->16
         11    >   INIT_FCALL                                               'is_callable'
         12        FETCH_OBJ_R                                      ~7      !0
         13        SEND_VAL                                                 ~7
         14        DO_ICALL                                         $8      
         15        BOOL                                             ~6      $8
         16    > > JMPZ                                                     ~6, ->23
   13    17    >   INIT_USER_CALL                                0          'call_user_func_array', !0
         18        SEND_ARRAY                                               !1
         19        CHECK_UNDEF_ARGS                                         
         20        DO_FCALL                                      0  $9      
         21      > RETURN                                                   $9
         22*       JMP                                                      ->30
   15    23    >   NEW                                              $10     'Exception'
         24        ROPE_INIT                                     3  ~12     'Fatal+error%3A+Call+to+undefined+method+stdObject%3A%3A'
         25        ROPE_ADD                                      1  ~12     ~12, !0
         26        ROPE_END                                      2  ~11     ~12, '%28%29'
         27        SEND_VAL_EX                                              ~11
         28        DO_FCALL                                      0          
         29      > THROW                                         0          $10
   17    30*     > RETURN                                                   null

End of function __call

End of class stdObject.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
150.84 ms | 1400 KiB | 21 Q