fork download
  1. <?php
  2.  
  3. class Foo {
  4.  
  5. public $text;
  6.  
  7. public function __construct(string $text)
  8. {
  9. $this->text = $text;
  10. }
  11. }
  12.  
  13. $FooArr = [
  14. new Foo('hello'),
  15. new Foo('ohayo'),
  16. new Foo('sup')
  17. ];
  18.  
  19. function displayFoo(Foo ...$foos) {
  20. foreach ($foos as $foo) {
  21. echo $foo->text . "\r\n";
  22. }
  23. }
  24.  
  25. displayfoo(...$FooArr);
Success #stdin #stdout 0s 82560KB
stdin
Standard input is empty
stdout
hello
ohayo
sup