note 98196 added to function.func-get-args

From: Date: Tue, 01 Jun 2010 03:51:44 +0000
Subject: note 98196 added to function.func-get-args
Groups: php.notes 
Request: Send a blank email to php-notes+get-169758@lists.php.net to get a copy of this message
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" } ---- Server IP: 80.64.47.13 Probable Submitter: 87.223.94.116 ---- Manual Page -- http://www.php.net/manual/en/function.func-get-args.php Edit -- https://master.php.net/note/edit/98196 Del: integrated -- https://master.php.net/note/delete/98196/integrated Del: useless -- https://master.php.net/note/delete/98196/useless Del: bad code -- https://master.php.net/note/delete/98196/bad+code Del: spam -- https://master.php.net/note/delete/98196/spam Del: non-english -- https://master.php.net/note/delete/98196/non-english Del: in docs -- https://master.php.net/note/delete/98196/in+docs Del: other reasons-- https://master.php.net/note/delete/98196 Reject -- https://master.php.net/note/reject/98196 Search -- https://master.php.net/manage/user-notes.php

« previous php.notes (#169758) next »