3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $kurier = new Siodemka(); echo $kurier->kosztDostawy(); class Siodemka { private $paczki = [1,2,3]; public function dodajPaczke(Paczka $paczka): Kurier { // } public function kosztDostawy(): float { $oplata = $this->oplataPodstawowa() + $this->oplataPaliwowa(); return $this->ilePaczek() * $this->dodajPodatek($oplata); } private function oplataPodstawowa(): float { return 12.34; } private function oplataPaliwowa(): float { return rand(100,999) / 100; } protected function dodajPodatek(float $wartosc): float { return $wartosc * 1.23; } protected function ilePaczek(): int { return count($this->paczki); } }
Output for 7.3.0alpha1
51.0327