- https://www.codewars.com/kata/596f72bbe7cd7296d1000029 Array Deep Count.
Started at 21:58 27.08.2020 Thursday Aug.
Finished at 21:25 27.08.2020 Thursday Aug. (0hrs 27minutes)
<?php | |
function deep_c(array $a): int { | |
$x = 0; | |
foreach($a as $v){ | |
$x+= 1; | |
if(is_array($v)) $x += deep_c($v); | |
} | |
return $x; | |
} | |
# https://www.codewars.com/kata/596f72bbe7cd7296d1000029 Array Deep Count. | |
/* | |
You should not use the PHP built-in count() function | |
Failed asserting that '<?php function deep_c(array $a): int {\n | |
$counter = 0;\n | |
foreach($a as $v){\n | |
$counter += 1;\n | |
if(is_array($v)) $counter += deep_c($v);\n | |
}\n | |
return $counter;\n | |
}' does not match PCRE pattern "/count/i". | |
*/ | |
function deep_c(array $a): int { | |
$counter = 0; | |
foreach($a as $v){ | |
$counter += 1; | |
if(is_array($v)) $counter += deep_c($v); | |
} | |
return $counter; | |
} |
Started at 21:58 27.08.2020 Thursday Aug.
Finished at 21:25 27.08.2020 Thursday Aug. (0hrs 27minutes)