3v4l.org

run code in 300+ PHP versions simultaneously
<?php function my_callback( &$param ) {} $callback = 'my_callback'; $a = true; $b = array( $a ); $c = array( &$a ); //my_callback( true ); // Fatal error: passing a value when reference is expected. my_callback( $a ); // OK my_callback( ...$b ); // OK my_callback( ...$c ); // OK //$callback( true ); // Fatal error: passing a value when reference is expected. $callback( $a ); // OK $callback( ...$b ); // OK $callback( ...$c ); // OK call_user_func( $callback, true ); // PHP 7.1+: Warning: Parameter 1 to my_callback() expected to be a reference, value given call_user_func( $callback, $a ); // PHP 7.1+: Warning: Parameter 1 to my_callback() expected to be a reference, value given call_user_func( $callback, ...$b ); // PHP 5.6+: Warning: Parameter 1 to my_callback() expected to be a reference, value given call_user_func( $callback, ...$c ); // PHP 7.0+: Warning: Parameter 1 to my_callback() expected to be a reference, value given call_user_func_array( $callback, array( true ) ); // PHP 7.0+: Warning: Parameter 1 to my_callback() expected to be a reference, value given call_user_func_array( $callback, array( $a ) ); // PHP 7.0+: Warning: Parameter 1 to my_callback() expected to be a reference, value given call_user_func_array( $callback, $b ); // PHP 5.6: Warning: Parameter 1 to my_callback() expected to be a reference, value given call_user_func_array( $callback, array( &$a ) ); // OK call_user_func_array( $callback, $c ); // OK
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/AfX8n
function name:  (null)
number of ops:  67
compiled vars:  !0 = $callback, !1 = $a, !2 = $b, !3 = $c
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    5     0  E >   ASSIGN                                                   !0, 'my_callback'
    6     1        ASSIGN                                                   !1, <true>
    7     2        INIT_ARRAY                                       ~6      !1
          3        ASSIGN                                                   !2, ~6
    8     4        INIT_ARRAY                                       ~8      !1
          5        ASSIGN                                                   !3, ~8
   11     6        INIT_FCALL                                               'my_callback'
          7        SEND_REF                                                 !1
          8        DO_FCALL                                      0          
   12     9        INIT_FCALL                                               'my_callback'
         10        SEND_UNPACK                                              !2
         11        CHECK_UNDEF_ARGS                                         
         12        DO_FCALL                                      1          
   13    13        INIT_FCALL                                               'my_callback'
         14        SEND_UNPACK                                              !3
         15        CHECK_UNDEF_ARGS                                         
         16        DO_FCALL                                      1          
   16    17        INIT_DYNAMIC_CALL                                        !0
         18        SEND_VAR_EX                                              !1
         19        DO_FCALL                                      0          
   17    20        INIT_DYNAMIC_CALL                                        !0
         21        SEND_UNPACK                                              !2
         22        CHECK_UNDEF_ARGS                                         
         23        DO_FCALL                                      1          
   18    24        INIT_DYNAMIC_CALL                                        !0
         25        SEND_UNPACK                                              !3
         26        CHECK_UNDEF_ARGS                                         
         27        DO_FCALL                                      1          
   20    28        INIT_USER_CALL                                1          'call_user_func', !0
         29        SEND_USER                                                <true>
         30        DO_FCALL                                      0          
   21    31        INIT_USER_CALL                                1          'call_user_func', !0
         32        SEND_USER                                                !1
         33        DO_FCALL                                      0          
   22    34        INIT_FCALL                                               'call_user_func'
         35        SEND_VAR                                                 !0
         36        SEND_UNPACK                                              !2
         37        CHECK_UNDEF_ARGS                                         
         38        DO_ICALL                                                 
   23    39        INIT_FCALL                                               'call_user_func'
         40        SEND_VAR                                                 !0
         41        SEND_UNPACK                                              !3
         42        CHECK_UNDEF_ARGS                                         
         43        DO_ICALL                                                 
   25    44        INIT_USER_CALL                                0          'call_user_func_array', !0
         45        SEND_ARRAY                                               <array>
         46        CHECK_UNDEF_ARGS                                         
         47        DO_FCALL                                      1          
   26    48        INIT_USER_CALL                                0          'call_user_func_array', !0
         49        INIT_ARRAY                                       ~21     !1
         50        SEND_ARRAY                                               ~21
         51        CHECK_UNDEF_ARGS                                         
         52        DO_FCALL                                      1          
   27    53        INIT_USER_CALL                                0          'call_user_func_array', !0
         54        SEND_ARRAY                                               !2
         55        CHECK_UNDEF_ARGS                                         
         56        DO_FCALL                                      1          
   28    57        INIT_USER_CALL                                0          'call_user_func_array', !0
         58        INIT_ARRAY                                       ~24     !1
         59        SEND_ARRAY                                               ~24
         60        CHECK_UNDEF_ARGS                                         
         61        DO_FCALL                                      1          
   29    62        INIT_USER_CALL                                0          'call_user_func_array', !0
         63        SEND_ARRAY                                               !3
         64        CHECK_UNDEF_ARGS                                         
         65        DO_FCALL                                      1          
         66      > RETURN                                                   1

Function my_callback:
Finding entry points
Branch analysis from position: 0
1 jumps found. (Code = 62) Position 1 = -2
filename:       /in/AfX8n
function name:  my_callback
number of ops:  2
compiled vars:  !0 = $param
line      #* E I O op                           fetch          ext  return  operands
-------------------------------------------------------------------------------------
    3     0  E >   RECV                                             !0      
          1      > RETURN                                                   null

End of function my_callback

Generated using Vulcan Logic Dumper, using php 8.0.0


preferences:
185.73 ms | 1458 KiB | 17 Q