- Output for 8.1.0 - 8.1.33, 8.2.0 - 8.2.29, 8.3.0 - 8.3.25, 8.4.1 - 8.4.12
- 1710
<?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);