3v4l.org

run code in 300+ PHP versions simultaneously
<?php class User { public function can($name) { return call_user_func(array($name, 'test')); } public static function __callStatic($name, $args) { return 'User::__callStatic'; } public function __call($name, $args) { return 'User::__call'; } } class Foo { public function can($name) { return call_user_func(array($name, 'test')); } public static function __callStatic($name, $args) { return 'Foo::__callStatic'; } public function __call($name, $args) { return 'Foo::__call?'; } } function can($name) { return call_user_func(array($name, 'test')); } $u = new User(); $f = new Foo(); var_dump($u->can('User')); var_dump($u->can('Foo')); var_dump($f->can('User')); var_dump($f->can('Foo')); var_dump(can('User')); var_dump(can('Foo'));
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qCUWI
function name:  (null)
number of ops:  43
compiled vars:  !0 = $u, !1 = $f
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   37     0  E >   NEW                                              $2      'User'
          1        DO_FCALL                                      0          
          2        ASSIGN                                                   !0, $2
   38     3        NEW                                              $5      'Foo'
          4        DO_FCALL                                      0          
          5        ASSIGN                                                   !1, $5
   39     6        INIT_FCALL                                               'var_dump'
          7        INIT_METHOD_CALL                                         !0, 'can'
          8        SEND_VAL_EX                                              'User'
          9        DO_FCALL                                      0  $8      
         10        SEND_VAR                                                 $8
         11        DO_ICALL                                                 
   40    12        INIT_FCALL                                               'var_dump'
         13        INIT_METHOD_CALL                                         !0, 'can'
         14        SEND_VAL_EX                                              'Foo'
         15        DO_FCALL                                      0  $10     
         16        SEND_VAR                                                 $10
         17        DO_ICALL                                                 
   41    18        INIT_FCALL                                               'var_dump'
         19        INIT_METHOD_CALL                                         !1, 'can'
         20        SEND_VAL_EX                                              'User'
         21        DO_FCALL                                      0  $12     
         22        SEND_VAR                                                 $12
         23        DO_ICALL                                                 
   42    24        INIT_FCALL                                               'var_dump'
         25        INIT_METHOD_CALL                                         !1, 'can'
         26        SEND_VAL_EX                                              'Foo'
         27        DO_FCALL                                      0  $14     
         28        SEND_VAR                                                 $14
         29        DO_ICALL                                                 
   43    30        INIT_FCALL                                               'var_dump'
         31        INIT_FCALL                                               'can'
         32        SEND_VAL                                                 'User'
         33        DO_FCALL                                      0  $16     
         34        SEND_VAR                                                 $16
         35        DO_ICALL                                                 
   44    36        INIT_FCALL                                               'var_dump'
         37        INIT_FCALL                                               'can'
         38        SEND_VAL                                                 'Foo'
         39        DO_FCALL                                      0  $18     
         40        SEND_VAR                                                 $18
         41        DO_ICALL                                                 
         42      > RETURN                                                   1

Function can:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qCUWI
function name:  can
number of ops:  7
compiled vars:  !0 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   33     0  E >   RECV                                             !0      
   34     1        INIT_ARRAY                                       ~1      !0
          2        ADD_ARRAY_ELEMENT                                ~1      'test'
          3        INIT_USER_CALL                                0          'call_user_func', ~1
          4        DO_FCALL                                      0  $2      
          5      > RETURN                                                   $2
   35     6*     > RETURN                                                   null

End of function can

Class User:
Function can:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qCUWI
function name:  can
number of ops:  7
compiled vars:  !0 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   RECV                                             !0      
    6     1        INIT_ARRAY                                       ~1      !0
          2        ADD_ARRAY_ELEMENT                                ~1      'test'
          3        INIT_USER_CALL                                0          'call_user_func', ~1
          4        DO_FCALL                                      0  $2      
          5      > RETURN                                                   $2
    7     6*     > RETURN                                                   null

End of function can

Function __callstatic:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qCUWI
function name:  __callStatic
number of ops:  4
compiled vars:  !0 = $name, !1 = $args
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    9     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   10     2      > RETURN                                                   'User%3A%3A__callStatic'
   11     3*     > RETURN                                                   null

End of function __callstatic

Function __call:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qCUWI
function name:  __call
number of ops:  4
compiled vars:  !0 = $name, !1 = $args
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   13     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   14     2      > RETURN                                                   'User%3A%3A__call'
   15     3*     > RETURN                                                   null

End of function __call

End of class User.

Class Foo:
Function can:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qCUWI
function name:  can
number of ops:  7
compiled vars:  !0 = $name
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   20     0  E >   RECV                                             !0      
   21     1        INIT_ARRAY                                       ~1      !0
          2        ADD_ARRAY_ELEMENT                                ~1      'test'
          3        INIT_USER_CALL                                0          'call_user_func', ~1
          4        DO_FCALL                                      0  $2      
          5      > RETURN                                                   $2
   22     6*     > RETURN                                                   null

End of function can

Function __callstatic:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qCUWI
function name:  __callStatic
number of ops:  4
compiled vars:  !0 = $name, !1 = $args
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   24     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   25     2      > RETURN                                                   'Foo%3A%3A__callStatic'
   26     3*     > RETURN                                                   null

End of function __callstatic

Function __call:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/qCUWI
function name:  __call
number of ops:  4
compiled vars:  !0 = $name, !1 = $args
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
   28     0  E >   RECV                                             !0      
          1        RECV                                             !1      
   29     2      > RETURN                                                   'Foo%3A%3A__call%3F'
   30     3*     > RETURN                                                   null

End of function __call

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
143.51 ms | 1009 KiB | 16 Q