Re: CLASS/Object lifetime - > more info

From: Date: Tue, 21 Feb 2006 19:49:02 +0000
Subject: Re: CLASS/Object lifetime - > more info
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-230827@lists.php.net to get a copy of this message
The function that gives me trouble --------- function fyll_sub_konto($pv){
                foreach($this->subposter AS $konto){
                        $konto->fyll_fra_post($pv);
                }
} ------------- $this->subposter is the array of CLASS2 function fyll_fra_post($post_vars){
    echo "(gruppe)class = ".get_class($this) ."<br>\n";
    $teller=0;
    foreach($this->poster AS $post=>$verd){
        $best="bestilt_".$post;
        $avik="avvik_".$post;
        $fakt="faktura_".$post;
$this->poster[$post]["bestilt"]=$post_vars[$best]; $this->poster[$post]["avvik"]=$post_vars[$avik]; $this->poster[$post]["faktura"]=$post_vars[$fakt];
    }
    $this->endret='ja';
    $this->sett_sum();
} If I print the data (after setting the new data) inside 'fyll_fra_post' it puts out the new data. If I do the same from 'fyll_sub_konto' (after foreach) it gives me the old data.

« previous php.general (#230827) next »