Array save in another function
E.x.

    public function test(){
    
        $array = array();
        $this->test2();
        foreach($array as $k=>$v){
            return $v;
        }
    }
    
    public function test2(){
    
        $array[] = 'Text';
    }

How to use array from first function to save information.
Because now function return for me null.
Array save in another function
===

E.x.

    public function test(){
    
        $array = array();
        $this->test2();
        foreach($array as $k=>$v){
            return $v;
        }
    }
    
    public function test2(){
    
        $array[] = 'Text';
    }

How to use array from first function to save information.
Because now function return for me null.