3v4l.org

run code in 300+ PHP versions simultaneously
<?php class Command { private $photoIds; private $categoryIds; private function setPhotoIds(int ...$photoIds):self { $this->photoIds = $photoIds; return $this; } private function setCategoryIds(int ...$categoryIds):self { $this->categoryIds = $categoryIds; return $this; } public function __construct(array $photoIds, array $categoryIds) { $this ->setPhotoIds(...$photoIds) ->setCategoryIds(...$categoryIds); } public function getPhotoIds():array { return $this->photoIds; } public function getCategoryIds():array { return $this->categoryIds; } } class Handler { public function __invoke(Command $command) { return array_sum($command->getPhotoIds(), $command->getCategoryIds()); } } $handler = new Handler(); $command = new Command([1, 2], [3, 4]); echo $handler($command);
Output for git.master, git.master_jit, rfc.property-hooks
Fatal error: Uncaught ArgumentCountError: array_sum() expects exactly 1 argument, 2 given in /in/7tVQB:44 Stack trace: #0 /in/7tVQB(44): array_sum(Array, Array) #1 /in/7tVQB(51): Handler->__invoke(Object(Command)) #2 {main} thrown in /in/7tVQB on line 44
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:
54.02 ms | 401 KiB | 8 Q