3v4l.org

run code in 300+ PHP versions simultaneously
<?php class foo { public function __call($name, $args) { switch ($name) { case 'a': switch (count($args)) { case 0: return call_user_func_array(array($this, 'a'), $args); break; case 1: return call_user_func_array(array($this, 'ab'), $args); break; } } } public function a() { return 'a called'; } public function ab($a) { return 'a with paramter called'; } } print_r((new foo)->a(2));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fgJ3t
function name:  (null)
number of ops:  9
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   29     0  E >   INIT_FCALL                                               'print_r'
          1        NEW                                              $0      'foo'
          2        DO_FCALL                                      0          
          3        INIT_METHOD_CALL                                         $0, 'a'
          4        SEND_VAL_EX                                              2
          5        DO_FCALL                                      0  $2      
          6        SEND_VAR                                                 $2
          7        DO_ICALL                                                 
          8      > RETURN                                                   1

Class foo:
Function __call:
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 44) Position 1 = 4, Position 2 = 5
Branch analysis from position: 4
1 jumps found. (Code = 42) Position 1 = 32
Branch analysis from position: 32
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 5
2 jumps found. (Code = 44) Position 1 = 8, Position 2 = 11
Branch analysis from position: 8
2 jumps found. (Code = 44) Position 1 = 10, Position 2 = 21
Branch analysis from position: 10
1 jumps found. (Code = 42) Position 1 = 31
Branch analysis from position: 31
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 21
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 11
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fgJ3t
function name:  __call
number of ops:  33
compiled vars:  !0 = $name, !1 = $args
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
          1        RECV                                             !1      
    8     2        IS_EQUAL                                                 !0, 'a'
          3      > JMPNZ                                                    ~2, ->5
          4    > > JMP                                                      ->32
    9     5    >   COUNT                                            ~3      !1
   10     6        CASE                                                     ~3, 0
          7      > JMPNZ                                                    ~4, ->11
   13     8    >   CASE                                                     ~3, 1
          9      > JMPNZ                                                    ~4, ->21
         10    > > JMP                                                      ->31
   11    11    >   FETCH_THIS                                       ~5      
         12        INIT_ARRAY                                       ~6      ~5
         13        ADD_ARRAY_ELEMENT                                ~6      'a'
         14        INIT_USER_CALL                                0          'call_user_func_array', ~6
         15        SEND_ARRAY                                               !1
         16        CHECK_UNDEF_ARGS                                         
         17        DO_FCALL                                      0  $7      
         18        FREE                                                     ~3
         19      > RETURN                                                   $7
   12    20*       JMP                                                      ->31
   14    21    >   FETCH_THIS                                       ~8      
         22        INIT_ARRAY                                       ~9      ~8
         23        ADD_ARRAY_ELEMENT                                ~9      'ab'
         24        INIT_USER_CALL                                0          'call_user_func_array', ~9
         25        SEND_ARRAY                                               !1
         26        CHECK_UNDEF_ARGS                                         
         27        DO_FCALL                                      0  $10     
         28        FREE                                                     ~3
         29      > RETURN                                                   $10
   15    30*       JMP                                                      ->31
         31    >   FREE                                                     ~3
   18    32    > > RETURN                                                   null

End of function __call

Function a:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fgJ3t
function name:  a
number of ops:  2
compiled vars:  none
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   21     0  E > > RETURN                                                   'a+called'
   22     1*     > RETURN                                                   null

End of function a

Function ab:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/fgJ3t
function name:  ab
number of ops:  3
compiled vars:  !0 = $a
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   24     0  E >   RECV                                             !0      
   25     1      > RETURN                                                   'a+with+paramter+called'
   26     2*     > RETURN                                                   null

End of function ab

End of class foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
126.2 ms | 1405 KiB | 15 Q