3v4l.org

run code in 500+ PHP versions simultaneously
<?php class User { public function register($email, $password, $active = null, $default = 0, ...$attributes) { $defined_vars = get_defined_vars(); print_r(['$defined_vars'=>$defined_vars]); $argc = func_num_args(); $argv = func_get_args(); $__mockery__argc = 0; $__mockery__argv = []; $__mockery__argv_named = []; foreach ((new ReflectionMethod(__CLASS__, __FUNCTION__))->getParameters() as $__mockery__parameter) { $__mockery__name = $__mockery__parameter->getName(); $__mockery__values = $defined_vars[$__mockery__name]; unset($defined_vars[$__mockery__name]); if (! $__mockery__parameter->isVariadic()) { $__mockery__argv_named[$__mockery__name] = $__mockery__values; $__mockery__argv[$__mockery__parameter->getPosition()] = $__mockery__values; ++$__mockery__argc; continue; } foreach($__mockery__values as $__mockery__key => $__mockery__value) { $__mockery__argv_named[$__mockery__key] = $__mockery__value; $__mockery__argv[$__mockery__argc++] = $__mockery__value; } } print_r([ '$argc' => $argc, '$argv' => $argv, '$__mockery__argc'=>$__mockery__argc, '$__mockery__argv' => $__mockery__argv, '$__mockery__argv_named' => $__mockery__argv_named, ]); return [$email, $password, $attributes]; } } $foo = new User(); $foo->register('admin@test.com', 'pass1', ...[ 'id' => 'uuid-1', 'phone' => '012-345-6789', 'role' => 'admin', ]); echo PHP_EOL.'--------'.PHP_EOL; $foo->register(...[ 'id' => 'uuid-2', 'email' => 'test@test.com', 'phone' => '987-654-3210', 'name' => 'first last2', 'role' => 'tester', 'password' => 'pass2' ]);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/e1UK7
function name:  (null)
number of ops:  15
compiled vars:  !0 = $foo
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   48     0  E >   NEW                                                  $1      'User'
          1        DO_FCALL                                          0          
          2        ASSIGN                                                       !0, $1
   50     3        INIT_METHOD_CALL                                             !0, 'register'
          4        SEND_VAL_EX                                                  'admin%40test.com'
          5        SEND_VAL_EX                                                  'pass1'
   51     6        SEND_UNPACK                                                  <array>
          7        CHECK_UNDEF_ARGS                                             
   50     8        DO_FCALL                                          1          
   56     9        ECHO                                                         '%0A--------%0A'
   58    10        INIT_METHOD_CALL                                             !0, 'register'
   59    11        SEND_UNPACK                                                  <array>
         12        CHECK_UNDEF_ARGS                                             
   58    13        DO_FCALL                                          1          
   65    14      > RETURN                                                       1

Class User:
Function register:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 26, Position 2 = 56
Branch analysis from position: 26
2 jumps found. (Code = 78) Position 1 = 27, Position 2 = 56
Branch analysis from position: 27
2 jumps found. (Code = 43) Position 1 = 37, Position 2 = 45
Branch analysis from position: 37
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
Branch analysis from position: 45
2 jumps found. (Code = 77) Position 1 = 46, Position 2 = 54
Branch analysis from position: 46
2 jumps found. (Code = 78) Position 1 = 47, Position 2 = 54
Branch analysis from position: 47
1 jumps found. (Code = 42) Position 1 = 46
Branch analysis from position: 46
Branch analysis from position: 54
1 jumps found. (Code = 42) Position 1 = 26
Branch analysis from position: 26
Branch analysis from position: 54
Branch analysis from position: 56
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 56
filename:       /in/e1UK7
function name:  register
number of ops:  70
compiled vars:  !0 = $email, !1 = $password, !2 = $active, !3 = $default, !4 = $attributes, !5 = $defined_vars, !6 = $argc, !7 = $argv, !8 = $__mockery__argc, !9 = $__mockery__argv, !10 = $__mockery__argv_named, !11 = $__mockery__parameter, !12 = $__mockery__name, !13 = $__mockery__values, !14 = $__mockery__value, !15 = $__mockery__key
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    4     0  E >   RECV                                                 !0      
          1        RECV                                                 !1      
          2        RECV_INIT                                            !2      null
          3        RECV_INIT                                            !3      0
          4        RECV_VARIADIC                                        !4      
    5     5        INIT_FCALL                                                   'get_defined_vars'
          6        DO_ICALL                                             $16     
          7        ASSIGN                                                       !5, $16
    6     8        INIT_FCALL                                                   'print_r'
          9        INIT_ARRAY                                           ~18     !5, '%24defined_vars'
         10        SEND_VAL                                                     ~18
         11        DO_ICALL                                                     
    8    12        FUNC_NUM_ARGS                                        ~20     
         13        ASSIGN                                                       !6, ~20
    9    14        FUNC_GET_ARGS                                        ~22     
         15        ASSIGN                                                       !7, ~22
   11    16        ASSIGN                                                       !8, 0
   12    17        ASSIGN                                                       !9, <array>
   13    18        ASSIGN                                                       !10, <array>
   14    19        NEW                                                  $27     'ReflectionMethod'
         20        SEND_VAL_EX                                                  'User'
         21        SEND_VAL_EX                                                  'register'
         22        DO_FCALL                                          0          
         23        INIT_METHOD_CALL                                             $27, 'getParameters'
         24        DO_FCALL                                          0  $29     
         25      > FE_RESET_R                                           $30     $29, ->56
         26    > > FE_FETCH_R                                                   $30, !11, ->56
   15    27    >   INIT_METHOD_CALL                                             !11, 'getName'
         28        DO_FCALL                                          0  $31     
         29        ASSIGN                                                       !12, $31
   16    30        FETCH_DIM_R                                          ~33     !5, !12
         31        ASSIGN                                                       !13, ~33
   18    32        UNSET_DIM                                                    !5, !12
   20    33        INIT_METHOD_CALL                                             !11, 'isVariadic'
         34        DO_FCALL                                          0  $35     
         35        BOOL_NOT                                             ~36     $35
         36      > JMPZ                                                         ~36, ->45
   21    37    >   ASSIGN_DIM                                                   !10, !12
         38        OP_DATA                                                      !13
   22    39        INIT_METHOD_CALL                                             !11, 'getPosition'
         40        DO_FCALL                                          0  $38     
         41        ASSIGN_DIM                                                   !9, $38
         42        OP_DATA                                                      !13
   24    43        PRE_INC                                                      !8
   26    44      > JMP                                                          ->26
   29    45    > > FE_RESET_R                                           $41     !13, ->54
         46    > > FE_FETCH_R                                           ~42     $41, !14, ->54
         47    >   ASSIGN                                                       !15, ~42
   31    48        ASSIGN_DIM                                                   !10, !15
         49        OP_DATA                                                      !14
   32    50        POST_INC                                             ~45     !8
         51        ASSIGN_DIM                                                   !9, ~45
         52        OP_DATA                                                      !14
   29    53      > JMP                                                          ->46
         54    >   FE_FREE                                                      $41
   14    55      > JMP                                                          ->26
         56    >   FE_FREE                                                      $30
   36    57        INIT_FCALL                                                   'print_r'
   37    58        INIT_ARRAY                                           ~47     !6, '%24argc'
   38    59        ADD_ARRAY_ELEMENT                                    ~47     !7, '%24argv'
   39    60        ADD_ARRAY_ELEMENT                                    ~47     !8, '%24__mockery__argc'
   40    61        ADD_ARRAY_ELEMENT                                    ~47     !9, '%24__mockery__argv'
   41    62        ADD_ARRAY_ELEMENT                                    ~47     !10, '%24__mockery__argv_named'
         63        SEND_VAL                                                     ~47
   36    64        DO_ICALL                                                     
   44    65        INIT_ARRAY                                           ~49     !0
         66        ADD_ARRAY_ELEMENT                                    ~49     !1
         67        ADD_ARRAY_ELEMENT                                    ~49     !4
         68      > RETURN                                                       ~49
   45    69*     > RETURN                                                       null

End of function register

End of class User.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
153.46 ms | 3226 KiB | 10 Q