Re: Losing values with array_walk...

From: Date: Fri, 11 Apr 2003 05:47:23 +0000
Subject: Re: Losing values with array_walk...
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-143449@lists.php.net to get a copy of this message
Well that is what I do?! The & sign in front of $aArrayToBuild : function setAnArray($oValue,$key,&$aArrayToBuild){ ... } Per L. "Burhan Khalid" <phplist@meidomus.com> wrote in message news:1049985650.5168.0.camel@Orgasmatron... > 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. >

« previous php.general (#143449) next »