3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Foo{ public static function Bar(&$num){ $num*=50; } } $functionname = "Foo::Bar"; $num = 3; echo 'call_user_func_array: '; call_user_func_array($functionname, array($num)); echo $num; echo "\n"; $num = 3; echo "other way: "; if (stristr($functionname, '::') !== false) { list($class, $function) = explode('::', $functionname); $class::$function($num); } else { $functionname($num); } echo $num;
Finding entry points
Branch analysis from position: 0
2 jumps found. (Code = 43) Position 1 = 18, Position 2 = 32
Branch analysis from position: 18
1 jumps found. (Code = 42) Position 1 = 35
Branch analysis from position: 35
1 jumps found. (Code = 62) Position 1 = -2
Branch analysis from position: 32
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/uq5t7
function name:  (null)
number of ops:  37
compiled vars:  !0 = $functionname, !1 = $num, !2 = $class, !3 = $function
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    8     0  E >   ASSIGN                                                   !0, 'Foo%3A%3ABar'
    9     1        ASSIGN                                                   !1, 3
   10     2        ECHO                                                     'call_user_func_array%3A+'
   11     3        INIT_USER_CALL                                0          'call_user_func_array', !0
          4        INIT_ARRAY                                       ~6      !1
          5        SEND_ARRAY                                               ~6
          6        CHECK_UNDEF_ARGS                                         
          7        DO_FCALL                                      0          
   12     8        ECHO                                                     !1
   13     9        ECHO                                                     '%0A'
   17    10        ASSIGN                                                   !1, 3
   18    11        ECHO                                                     'other+way%3A+'
   19    12        INIT_FCALL                                               'stristr'
         13        SEND_VAR                                                 !0
         14        SEND_VAL                                                 '%3A%3A'
         15        DO_ICALL                                         $9      
         16        TYPE_CHECK                                  1018          $9
         17      > JMPZ                                                     ~10, ->32
   20    18    >   INIT_FCALL                                               'explode'
         19        SEND_VAL                                                 '%3A%3A'
         20        SEND_VAR                                                 !0
         21        DO_ICALL                                         $11     
         22        FETCH_LIST_R                                     $12     $11, 0
         23        ASSIGN                                                   !2, $12
         24        FETCH_LIST_R                                     $14     $11, 1
         25        ASSIGN                                                   !3, $14
         26        FREE                                                     $11
   21    27        FETCH_CLASS                                   0  $16     !2
         28        INIT_STATIC_METHOD_CALL                                  $16, !3
         29        SEND_VAR_EX                                              !1
         30        DO_FCALL                                      0          
         31      > JMP                                                      ->35
   23    32    >   INIT_DYNAMIC_CALL                                        !0
         33        SEND_VAR_EX                                              !1
         34        DO_FCALL                                      0          
   26    35    >   ECHO                                                     !1
         36      > RETURN                                                   1

Class Foo:
Function bar:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/uq5t7
function name:  Bar
number of ops:  3
compiled vars:  !0 = $num
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    4     0  E >   RECV                                             !0      
          1        ASSIGN_OP                                     3          !0, 50
          2      > RETURN                                                   null

End of function bar

End of class Foo.

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
179.83 ms | 1400 KiB | 17 Q