What's the problem for the following code:
function rString($s) {
$news = "";
for ($i = strlen($s); $i >= 0; $i--) {
$news += $s[$i];
}
return $news;
}
echo rString("happy birthday");
It returns 0 which is unexpected, I thought "" will be an empty string, and for every iteration the last character of a string should append to the $news (that is, to reverse a string). But it seems like "" is not accepted in php?