Re: array walk and class member functions
| From: | Jochem Maas | Date: | Wed, 12 Jan 2005 12:56:36 +0000 |
| Subject: | Re: array walk and class member functions | ||
| References: | 1 2 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-206176@lists.php.net to get a copy of this message | ||
Jochem Maas wrote:
Tom wrote:<snip> Sorry Tom, I hit the send button too early! I mean to add some context to the code below so you would (hopefully) understand what I mean:
OR define the function outside of the class e.g. function aFunction($value, $key) {...was meant to be: function aFunction($value, $key) {global $aReturnString; $aReturnString = $aReturnString.$value;}
global $aReturnString;
$aReturnString = $aReturnString.$value;
}
class aClass
{
some other stuff, constructor etcpublic function aPublicFunction($anArray) {
global $aRetrunString;
function aFunction($value, $key)
{
global $aReturnString;
$aReturnString = $aReturnString.$value; }
array_walk($anArray,'aFunction');
return $aReturnString;
}
// rest of the class definition goes here...
<snip>