note 98196 deleted from function.func-get-args by thiago

[email protected]
Newsgroups php.notes
Message-ID <[email protected]>
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"
}
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.