<?phpfunction reverse($str) { $count = strlen($str); for ($i = $count - 1; $i >= 0; $i--) { yield $str[$i]; }}foreach (reverse("string") as $c) { echo $c;}// printed gnirts