Re: Can i take the variable name in a function?

From: Date: Wed, 11 Oct 2006 17:19:22 +0000
Subject: Re: Can i take the variable name in a function?
References: 1 2 3 4 5 6 7  Groups: php.general 
Request: Send a blank email to php-general+get-242991@lists.php.net to get a copy of this message
On 10/11/06, Andy Hultgren <wearhdphp@gmail.com> wrote:
<?php function add_some_extra(&$string) { $string .= 'and something extra.'; } $str = 'This is a string, '; add_some_extra($str);
echo $str;    // outputs 'This is a string, and something extra.'
?> I think that does what you want?
In the add_some_extra example you gave he wants the named value of the passed parameter which is $str.

« previous php.general (#242991) next »