note 98196 deleted from function.func-get-args by thiago
| From: | thiago@php.net | Date: | Tue, 01 Jun 2010 04:08:28 +0000 |
| Subject: | note 98196 deleted from function.func-get-args by thiago | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-169759@lists.php.net to get a copy of this message | ||
Note Submitter: Anonymous
----
Does not work with references.
<?php
$a = array( 'foo' => 'bar' );
function signal( ) {
$args = func_get_args( );
call_user_func_array( 'slot', $args );
}
function slot( &$ref ) {
$ref['foo'] = 'test';
}
signal( $a );
var_dump( $a );
?>
PHP Warning: Parameter 1 to slot() expected to be a reference, value given in
/usr/home/jpic/tests.php on line 6
PHP Stack trace:
PHP 1. {main}() /usr/home/jpic/tests.php:0
PHP 2. signal() /usr/home/jpic/tests.php:13
PHP 3. call_user_func_array() /usr/home/jpic/tests.php:6
Warning: Parameter 1 to slot() expected to be a reference, value given in /usr/home/jpic/tests.php
on line 6
Call Stack:
0.0009 319136 1. {main}() /usr/home/jpic/tests.php:0
0.0012 319392 2. signal() /usr/home/jpic/tests.php:13
0.0014 319800 3. call_user_func_array() /usr/home/jpic/tests.php:6
Dump $_SERVER
Dump $_GET
Dump $_POST
Dump $_COOKIE
Dump $_FILES
Dump $_ENV
Dump $_SESSION
Dump $_REQUEST
array(1) {
["foo"]=>
string(3) "bar"
}