3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Test { public function __call($name, $args) { $method = $name.'_'.join('_', array_map('gettype', $args)); var_dump($method); if(method_exists($this, $method)) { return call_user_func_array([$this, $method], $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/TOW3U
function name:  (null)
number of ops:  12
compiled vars:  !0 = $obj
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   25     0  E >   NEW                                              $1      'Test'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $1
   26     3        INIT_METHOD_CALL                                         !0, 'foo'
          4        SEND_VAL_EX                                              5
          5        SEND_VAL_EX                                              'bar'
          6        DO_FCALL                                      0          
   27     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 = 22, Position 2 = 30
Branch analysis from position: 22
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 30
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/TOW3U
function name:  __call
number of ops:  31
compiled vars:  !0 = $name, !1 = $args, !2 = $method
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    6     2        CONCAT                                           ~3      !0, '_'
          3        INIT_FCALL                                               'join'
          4        SEND_VAL                                                 '_'
          5        INIT_FCALL                                               'array_map'
          6        SEND_VAL                                                 'gettype'
          7        SEND_VAR                                                 !1
          8        DO_ICALL                                         $4      
          9        SEND_VAR                                                 $4
         10        DO_ICALL                                         $5      
         11        CONCAT                                           ~6      ~3, $5
         12        ASSIGN                                                   !2, ~6
    7    13        INIT_FCALL                                               'var_dump'
         14        SEND_VAR                                                 !2
         15        DO_ICALL                                                 
    8    16        INIT_FCALL                                               'method_exists'
         17        FETCH_THIS                                       ~9      
         18        SEND_VAL                                                 ~9
         19        SEND_VAR                                                 !2
         20        DO_ICALL                                         $10     
         21      > JMPZ                                                     $10, ->30
   10    22    >   FETCH_THIS                                       ~11     
         23        INIT_ARRAY                                       ~12     ~11
         24        ADD_ARRAY_ELEMENT                                ~12     !2
         25        INIT_USER_CALL                                0          'call_user_func_array', ~12
         26        SEND_ARRAY                                               !1
         27        CHECK_UNDEF_ARGS                                         
         28        DO_FCALL                                      0  $13     
         29      > RETURN                                                   $13
   12    30    > > 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/TOW3U
function name:  foo_int_string
number of ops:  4
compiled vars:  !0 = $x, !1 = $y
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   14     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   16     2        ECHO                                                     'Called+method+implementation+with+1-st+%28int%29+and+2-nd+%28string%29+parameters%0A'
   17     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/TOW3U
function name:  foo_int_int
number of ops:  4
compiled vars:  !0 = $x, !1 = $y
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   19     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   21     2        ECHO                                                     'Called+method+implementation+with+1-st+%28int%29+and+2-nd+%28int%29+parameters%0A'
   22     3      > RETURN                                                   null

End of function foo_int_int

End of class Test.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
161.53 ms | 1400 KiB | 21 Q