3v4l.org

run code in 500+ PHP versions simultaneously
<?php class MyClass { public function myMethod($foo) { $reflection = new ReflectionMethod(__CLASS__, __FUNCTION__); $arg_names = []; foreach ($reflection->getParameters() as $parameter) { $arg_names[] = $parameter->name; } if (!in_array('args', $arg_names)) { echo "This is where the deprecation message would be set"; $args = func_get_args(); unset($args[0]); } echo $foo . "\n"; print_r($args); } } class ChildClass extends MyClass { public function myMethod($foo, ...$args) { $reflection = new ReflectionMethod(__CLASS__, __FUNCTION__); $arg_names = []; foreach ($reflection->getParameters() as $parameter) { $arg_names[] = $parameter->name; } if (!in_array('args', $arg_names)) { echo "This is where the deprecation message would be set"; $args = func_get_args(); unset($args[0]); } echo $foo . "\n"; print_r($args); } } $myClass = new MyClass(); $myClass->myMethod("Hi", "here", "are","some", "args"); echo "\n"; $childClass = new ChildClass(); $childClass->myMethod("Hi", "here", "are","some", "args");
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/FNdOm
function name:  (null)
number of ops:  22
compiled vars:  !0 = $myClass, !1 = $childClass
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   37     0  E >   NEW                                                  $2      'MyClass'
          1        DO_FCALL                                          0          
          2        ASSIGN                                                       !0, $2
   38     3        INIT_METHOD_CALL                                             !0, 'myMethod'
          4        SEND_VAL_EX                                                  'Hi'
          5        SEND_VAL_EX                                                  'here'
          6        SEND_VAL_EX                                                  'are'
          7        SEND_VAL_EX                                                  'some'
          8        SEND_VAL_EX                                                  'args'
          9        DO_FCALL                                          0          
   39    10        ECHO                                                         '%0A'
   40    11        NEW                                                  $6      'ChildClass'
         12        DO_FCALL                                          0          
         13        ASSIGN                                                       !1, $6
   41    14        INIT_METHOD_CALL                                             !1, 'myMethod'
         15        SEND_VAL_EX                                                  'Hi'
         16        SEND_VAL_EX                                                  'here'
         17        SEND_VAL_EX                                                  'are'
         18        SEND_VAL_EX                                                  'some'
         19        SEND_VAL_EX                                                  'args'
         20        DO_FCALL                                          0          
         21      > RETURN                                                       1

Class MyClass:
Function mymethod:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 10, Position 2 = 15
Branch analysis from position: 10
2 jumps found. (Code = 78) Position 1 = 11, Position 2 = 15
Branch analysis from position: 11
1 jumps found. (Code = 42) Position 1 = 10
Branch analysis from position: 10
Branch analysis from position: 15
2 jumps found. (Code = 43) Position 1 = 19, Position 2 = 23
Branch analysis from position: 19
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 23
Branch analysis from position: 15
filename:       /in/FNdOm
function name:  myMethod
number of ops:  29
compiled vars:  !0 = $foo, !1 = $reflection, !2 = $arg_names, !3 = $parameter, !4 = $args
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
    4     0  E >   RECV                                                 !0      
    5     1        NEW                                                  $5      'ReflectionMethod'
          2        SEND_VAL_EX                                                  'MyClass'
          3        SEND_VAL_EX                                                  'myMethod'
          4        DO_FCALL                                          0          
          5        ASSIGN                                                       !1, $5
    6     6        ASSIGN                                                       !2, <array>
    7     7        INIT_METHOD_CALL                                             !1, 'getParameters'
          8        DO_FCALL                                          0  $9      
          9      > FE_RESET_R                                           $10     $9, ->15
         10    > > FE_FETCH_R                                                   $10, !3, ->15
    8    11    >   FETCH_OBJ_R                                          ~12     !3, 'name'
         12        ASSIGN_DIM                                                   !2
         13        OP_DATA                                                      ~12
    7    14      > JMP                                                          ->10
         15    >   FE_FREE                                                      $10
   10    16        FRAMELESS_ICALL_2                in_array            ~13     'args', !2
         17        BOOL_NOT                                             ~14     ~13
         18      > JMPZ                                                         ~14, ->23
   11    19    >   ECHO                                                         'This+is+where+the+deprecation+message+would+be+set'
   12    20        FUNC_GET_ARGS                                        ~15     
         21        ASSIGN                                                       !4, ~15
   13    22        UNSET_DIM                                                    !4, 0
   15    23    >   CONCAT                                               ~17     !0, '%0A'
         24        ECHO                                                         ~17
   16    25        INIT_FCALL                                                   'print_r'
         26        SEND_VAR                                                     !4
         27        DO_ICALL                                                     
   17    28      > RETURN                                                       null

End of function mymethod

End of class MyClass.

Class ChildClass:
Function mymethod:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 77) Position 1 = 11, Position 2 = 16
Branch analysis from position: 11
2 jumps found. (Code = 78) Position 1 = 12, Position 2 = 16
Branch analysis from position: 12
1 jumps found. (Code = 42) Position 1 = 11
Branch analysis from position: 11
Branch analysis from position: 16
2 jumps found. (Code = 43) Position 1 = 20, Position 2 = 24
Branch analysis from position: 20
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 24
Branch analysis from position: 16
filename:       /in/FNdOm
function name:  myMethod
number of ops:  30
compiled vars:  !0 = $foo, !1 = $args, !2 = $reflection, !3 = $arg_names, !4 = $parameter
line      #* E I O op                               fetch          ext  return  operands
-----------------------------------------------------------------------------------------
   21     0  E >   RECV                                                 !0      
          1        RECV_VARIADIC                                        !1      
   22     2        NEW                                                  $5      'ReflectionMethod'
          3        SEND_VAL_EX                                                  'ChildClass'
          4        SEND_VAL_EX                                                  'myMethod'
          5        DO_FCALL                                          0          
          6        ASSIGN                                                       !2, $5
   23     7        ASSIGN                                                       !3, <array>
   24     8        INIT_METHOD_CALL                                             !2, 'getParameters'
          9        DO_FCALL                                          0  $9      
         10      > FE_RESET_R                                           $10     $9, ->16
         11    > > FE_FETCH_R                                                   $10, !4, ->16
   25    12    >   FETCH_OBJ_R                                          ~12     !4, 'name'
         13        ASSIGN_DIM                                                   !3
         14        OP_DATA                                                      ~12
   24    15      > JMP                                                          ->11
         16    >   FE_FREE                                                      $10
   27    17        FRAMELESS_ICALL_2                in_array            ~13     'args', !3
         18        BOOL_NOT                                             ~14     ~13
         19      > JMPZ                                                         ~14, ->24
   28    20    >   ECHO                                                         'This+is+where+the+deprecation+message+would+be+set'
   29    21        FUNC_GET_ARGS                                        ~15     
         22        ASSIGN                                                       !1, ~15
   30    23        UNSET_DIM                                                    !1, 0
   32    24    >   CONCAT                                               ~17     !0, '%0A'
         25        ECHO                                                         ~17
   33    26        INIT_FCALL                                                   'print_r'
         27        SEND_VAR                                                     !1
         28        DO_ICALL                                                     
   34    29      > RETURN                                                       null

End of function mymethod

End of class ChildClass.

Generated using Vulcan Logic Dumper, using php 8.5.0


preferences:
136.25 ms | 1758 KiB | 14 Q