3v4l.org

run code in 300+ PHP versions simultaneously
<?php declare(strict_types = 1); $a = ['net' => ['domain' => ['www' => null, 'shit' => null]]]; function walk(array $a, string $stem = ''): Generator { foreach ($a as $k => $v) { $current = $stem ? "$stem.$k" : $k; if (is_array($v)) { yield from walk($v, $current); } else { yield $current; } } } foreach (walk($a) as $domain) { print "$domain\n"; }

This is an error 500

Value for `_results` contains invalid data `array`


preferences:
159.9 ms | 2722 KiB | 11 Q