PHP 8.0 Syntax Showcase Sep 30, 2020 • Comments • Share Since RC1 is released today, I decided to make a small demonstration of PHP 8.0 syntax features. <?php #[FuncAttribute] function func(SplHeap|ArrayObject|null $object, mixed $value = null): ArrayAccess|false { return match ($object?->count()) { 0, null => throw new RuntimeException(), default => $object, }; } try { func(object: new ArrayObject()); } catch (RuntimeException) { // ignore } Comments Please enable JavaScript to view the comments powered by Disqus. Comments powered by Disqus
Comments
Comments powered by Disqus