3v4l.org

run code in 200+ php & hhvm versions
Bugs & Features
<?php $kurier = new Siodemka(); echo $kurier->oplataPodstawowa(); class Siodemka { private $paczki = [1,2,3]; public function dodajPaczke(Paczka $paczka): Siodemka { // } 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
Fatal error: Uncaught Error: Call to private method Siodemka::oplataPodstawowa() from context '' in /in/XeVKQ:4 Stack trace: #0 {main} thrown in /in/XeVKQ on line 4
Process exited with code 255.