<?php function sum($x) { return new class ($x) { function __construct(private int $x = 0) {} function __invoke($num): static { return new static($num + $this->x); } function __toString(): string { return (string)$this->x; } }; } echo sum(1000)(400)(80)(8)(200)(20)(2);
You have javascript disabled. You will not be able to edit any code.