数组成员不会保存

i learn php and stuck in trouble with next code:

    $people = new people();
    $people->getByNumber($value[0]);    
    $peoples = array();
    $count_people = 5;
    for($i=1; $i<=$count_people; $i++)
    {
        $people->getByNumber($i);
        $peoples[$i] = $people;
        print_r($peoples[$i]);
    }
    print_r($peoples);

so after cycle "for" $peoples dont show any information and print_r tell, that array consist of empty values (but keys exists). While cycle work, inside it print_r show me right pair key->value. How can i repair it to use right $peoples after cycle?

upd: in for-loop by print_r($peoples[$i]); i can see that:

people Object
 (
    [id] =&gt; 1
    [age] =&gt; 19
    [short_name] =&gt; Jhon
    [full_name] =&gt; Jhon Persh
    [image] =&gt; 
 )

but after for-loop $peoples contains only:

Array
(
    [1] =&gt; people Object
        (
            [id] =&gt; 
        [age] =&gt; 
        [short_name] =&gt; 
        [full_name] =&gt; 
        [image] =&gt; 
        )

    [2] =&gt; people Object
        (
            [id] =&gt; 
        [age] =&gt; 
        [short_name] =&gt; 
        [full_name] =&gt; 
        [image] =&gt;  
        )

    [3] =&gt; people Object
        (
            [id] =&gt; 
        [age] =&gt; 
        [short_name] =&gt; 
        [full_name] =&gt; 
        [image] =&gt; 
        )

    [4] =&gt; people Object
        (
            [id] =&gt;
        [age] =&gt; 
        [short_name] =&gt; 
        [full_name] =&gt; 
        [image] =&gt;  
        )

    [5] =&gt; people Object
        (
          [id] =&gt; 
          [age] =&gt; 
          [short_name] =&gt; 
          [full_name] =&gt; 
          [image] =&gt; 
        )

)

upd2:

public function getByNumber($id)
    {
        $classProperty = get_object_vars($this);
        foreach ($classProperty as $key=>$value)
            $member[] = $key;

        $data = //random data generation;
        foreach ($member as $key =>$field)
        {
            $this->$field = $data[$field];
        }
    }

I found answer in construcnt new object of class $people1 = new People(), then just use $peoples[] = $people1 in loop after call method getByNumber($id); btw dont know why copy constructor dont call itself.

In the for-loop you are setting $peoples[$i] to $people, but there is no variable called $people. You call $people->getByNumber($i) but don't save it anywhere.

Your for-loop should look something like this:

$p = $people->getByNumber($id);
$peoples[$i] = $p;