<?php

class Foo {
    
    public $text;
    
    public function __construct(string $text)
    {
        $this->text = $text;
    }
}

$FooArr = [
    new Foo('hello'),
    new Foo('ohayo'),
    new Foo('sup')
    ];
    
function displayFoo(Foo ...$foos) {
    foreach ($foos as $foo) {
        echo $foo->text . "\r\n";
    }
}

displayfoo(...$FooArr);