3v4l.org

run code in 200+ PHP versions simultaneously
<?php class MultiImageComponent { public $imgs = []; public function __construct() { foreach(func_get_args() as $url) { $this->imgs[] = new Image($url); } } public function getUrls() { $urls = []; foreach($this->imgs as $img) { $urls[] = $img->getUrl(); } return $urls; } } class Image { private $url = ''; public function __construct($url) { $this->url = $url; } public function getUrl() { return $this->url; } } $mic = new MultiImageComponent("https://photos.smugmug.com/Comics/Pa-comics/n-xmQS5/i-RZcDzzK/0/2100x20000/i-RZcDzzK-2100x20000.jpg", "http://www.acq-inc.com/assets/ai/img/img_staff.gif", "https://a.fsdn.com/sd/topics/business_64.png"); var_dump($mic->getUrls());
based on SWrSR
Output for 7.1.25 - 7.3.3
array(3) { [0]=> string(99) "https://photos.smugmug.com/Comics/Pa-comics/n-xmQS5/i-RZcDzzK/0/2100x20000/i-RZcDzzK-2100x20000.jpg" [1]=> string(50) "http://www.acq-inc.com/assets/ai/img/img_staff.gif" [2]=> string(44) "https://a.fsdn.com/sd/topics/business_64.png" }