does this work?? change
      foreach ($this->children as $child) {
to
      foreach ($this->children as &$child) {


-----Original Message-----
From: Ken Kinder [mailto:[EMAIL PROTECTED]]
Sent: Friday, January 11, 2002 10:44 AM
To: [EMAIL PROTECTED]
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: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]

Reply via email to