While working on a kata for Codewars, I am coming across an error when printing a value. Although the output of the code looks fine, I am getting the error that Array (...) does not match expected type "NULL".
Any ideas what I can change in my code to return a string?
function reverseSeq ($n) {
$n = range($n, 1);
foreach($n as $i) {
if ($i > 1) {
print_r ($i.",");
$i--;
} else {
print_r ($i);
}
}
}
The output, when $n
is 3, prints 3,2,1 as it should. However, it should return as a string rather than an integer.