3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test { public function __call($name, $args) { $hash = join('_', array_map('gettype')); if(method_exists($this, $name.$hash)) { return call_user_func_array([$this, $name.$hash], $args); } } protected function foo_int_string($x, $y) { echo('Called method implementation with 1-st (int) and 2-nd (string) parameters'.PHP_EOL); } protected function foo_int_int($x, $y) { echo('Called method implementation with 1-st (int) and 2-nd (int) parameters'.PHP_EOL); } } $obj=new Test(); $obj->foo(5, "bar"); $obj->foo(8, 2);
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2GCp4
function name:  (null)
number of ops:  12
compiled vars:  !0 = $obj
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   24     0  E >   NEW                                              $1      'Test'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   25     3        INIT_METHOD_CALL                                         !0, 'foo'
          4        SEND_VAL_EX                                              5
          5        SEND_VAL_EX                                              'bar'
          6        DO_FCALL                                      0          
   26     7        INIT_METHOD_CALL                                         !0, 'foo'
          8        SEND_VAL_EX                                              8
          9        SEND_VAL_EX                                              2
         10        DO_FCALL                                      0          
         11      > RETURN                                                   1

Class Test:
Function __call:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 17, Position 2 = 26
Branch analysis from position: 17
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 26
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2GCp4
function name:  __call
number of ops:  27
compiled vars:  !0 = $name, !1 = $args, !2 = $hash
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    6     2        INIT_FCALL                                               'join'
          3        SEND_VAL                                                 '_'
          4        INIT_FCALL                                               'array_map'
          5        SEND_VAL                                                 'gettype'
          6        DO_ICALL                                         $3      
          7        SEND_VAR                                                 $3
          8        DO_ICALL                                         $4      
          9        ASSIGN                                                   !2, $4
    7    10        INIT_FCALL                                               'method_exists'
         11        FETCH_THIS                                       ~6      
         12        SEND_VAL                                                 ~6
         13        CONCAT                                           ~7      !0, !2
         14        SEND_VAL                                                 ~7
         15        DO_ICALL                                         $8      
         16      > JMPZ                                                     $8, ->26
    9    17    >   FETCH_THIS                                       ~9      
         18        INIT_ARRAY                                       ~10     ~9
         19        CONCAT                                           ~11     !0, !2
         20        ADD_ARRAY_ELEMENT                                ~10     ~11
         21        INIT_USER_CALL                                0          'call_user_func_array', ~10
         22        SEND_ARRAY                                               !1
         23        CHECK_UNDEF_ARGS                                         
         24        DO_FCALL                                      0  $12     
         25      > RETURN                                                   $12
   11    26    > > RETURN                                                   null

End of function __call

Function foo_int_string:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2GCp4
function name:  foo_int_string
number of ops:  4
compiled vars:  !0 = $x, !1 = $y
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   15     2        ECHO                                                     'Called+method+implementation+with+1-st+%28int%29+and+2-nd+%28string%29+parameters%0A'
   16     3      > RETURN                                                   null

End of function foo_int_string

Function foo_int_int:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/2GCp4
function name:  foo_int_int
number of ops:  4
compiled vars:  !0 = $x, !1 = $y
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   18     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   20     2        ECHO                                                     'Called+method+implementation+with+1-st+%28int%29+and+2-nd+%28int%29+parameters%0A'
   21     3      > RETURN                                                   null

End of function foo_int_int

End of class Test.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
155.92 ms | 1400 KiB | 19 Q