3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Item { // more code public function getPrice() { return $this->price; } public function setPrice(float $price) { $this->price = $price; } public function setTitle(string $title) { $this->title = $title; } public function setPublished(bool $published) { $this->published = $published; } public function setId(int $id) { $this->id = $id; } } $item = new Item(); $item->setPrice('string'); var_dump($item->getPrice()); ?>
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught TypeError: Item::setPrice(): Argument #1 ($price) must be of type float, string given, called in /in/PYARb on line 27 and defined in /in/PYARb:9 Stack trace: #0 /in/PYARb(27): Item->setPrice('string') #1 {main} thrown in /in/PYARb on line 9
Process exited with code 255.

This tab shows result from various feature-branches currently under review by the php developers. Contact me to have additional branches featured.

Active branches

Archived branches

Once feature-branches are merged or declined, they are no longer available. Their functionality (when merged) can be viewed from the main output page


preferences:
52.61 ms | 401 KiB | 8 Q