value = $value; $this->unit = $unit; } public function asString (): string { return $this->value . $this->unit; } } /** * @return Collection */ function getMeasures (): Collection { $mesures_avant = new Collection(); $mesures_avant->add(new Measure(38), new Measure(29)); $measures = new Collection(); $measures->add(new Measure(27), new Measure(34)); $measures->prependCollection($mesures_avant); return $measures; } echo 'Measures :' . PHP_EOL; foreach (getMeasures() as $no => $measure) { echo "\t#" . $no . ' = ' . $measure->asString() . PHP_EOL; }