Re: Specific References Incident
| From: | Ken Kinder | Date: | Fri, 11 Jan 2002 00:27:31 +0000 |
| Subject: | Re: Specific References Incident | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-80137@lists.php.net to get a copy of this message | ||
Nope. Tried that too.
On Thursday 10 January 2002 05:18 pm, Rasmus Lerdorf wrote:
> Use a while(list()=each()) loop.
>
> On Thu, 10 Jan 2002, Ken Kinder wrote:
> > Negative.
> >
> > On Thursday 10 January 2002 04:54 pm, Mark wrote:
> > > On Thu, 10 Jan 2002 16:49:45 -0700, Ken Kinder wrote:
> > > >That's what I had thought too, but no:
> > > >
> > > >Parse error: parse error, expecting
T_VARIABLE' or
> > > >'$'' in
> > > >/home/ken/Projects/kwidgets/widgets.inc on line 74
> > >
> > > how about this:
> > > foreach ($this->children as $key => $value) {
> > > $child=&$this->children[$key];
> > >
> > > >On Thursday 10 January 2002 04:51 pm, Martin Towell wrote:
> > > >> does this work?? change
> > > >> foreach ($this->children as $child) {
> > > >> to
> > > >> foreach ($this->children as &$child) {
> > > >>
> > > >>
> > > >> -----Original Message-----
> > > >> From: Ken Kinder [mailto:ken@notenetwork.com]
> > > >> Sent: Friday, January 11, 2002 10:44 AM
> > > >> To: php-general@lists.php.net
> > > >> Subject: [PHP] Specific References Incident
> > > >>
> > > >>
> > > >> I have one specific incident I could use some help with too. I
> > > >>have the
> > > >> following method:
> > > >>
> > > >> function validate() {
> > > >> if ($this->returning) {
> > > >> $errors = array();
> > > >>
> > > >> foreach ($this->children as $child) {
> > > >> $child->error = "Foo";
> > > >> $error = $child->validate();
> > > >> if ($error) {
> > > >> $this->errors_exist = 1;
> > > >> array_push ($errors, $error);
> > > >> }
> > > >> }
> > > >> }
> > > >>
> > > >> $this->errors = $errors;
> > > >> }
> > > >>
> > > >> The $this->children attribute should be an array of (references
> > >
> > > to)
> > >
> > > >> objects.
> > > >>
> > > >> I think somehow in the foreach ($this->children as $child) the
> > > >>objects are
> > > >> being copied, as $child->validate(); seems not to effect the
> > > >>original
> > > >> objects.
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, e-mail: php-general-unsubscribe@lists.php.net
> > For additional commands, e-mail: php-general-help@lists.php.net
> > To contact the list administrators, e-mail: php-list-admin@lists.php.net