Re: Losing values with array_walk...
| From: | Burhan Khalid | Date: | Thu, 10 Apr 2003 14:40:50 +0000 |
| Subject: | Re: Losing values with array_walk... | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-143342@lists.php.net to get a copy of this message | ||
On Thu, 2003-04-10 at 04:30, Per Lundkvist wrote:
> My script below works and $aArrayToBuild (reference to $this->aUsers) is
> containing what I want all along to the end of the array_walk BUT when
> array_walk is finished and the script continue with the next line, my
> $this->aUsers is empty??? So it seems like $this->aUsers only keep it values
> during the array_walk...??
>
>
> My script:
> // --------------------------------------------------
>
>
> array_walk($this->aAllUsers, array($this,"setAnArray"), $this->aUsers);
>
>
>
>
> function setAnArray($oValue,$key,&$aArrayToBuild){
> $aArrayToBuild[$key] = $oValue->first_name;
> }
>
> // --------------------------------------------------
>
Try passing $this->aUsers by reference
--
Burhan Khalid
phplist[at]meidomus[dot]com
Please add a reply-to: header
in your messages that points
to the mailing list address
so that all mail is properly
archived and viewed.