3v4l.org

run code in 300+ PHP versions simultaneously
<?php class PriceList { /** * @var float[] */ protected $data = []; public function addPrice(float $price): void { $this->data[] = $price; } /** * @return float[] Array of prices */ public function all(): array { return $this->data; } } $priceList = new PriceList(); $priceList->addPrice(29.99); $priceList->addPrice(89); $priceList->addPrice(199); print_r($priceList->all());

preferences:
57.2 ms | 402 KiB | 5 Q