- mb_substr: documentation ( source)
- mb_strlen: documentation ( source)
- implode: documentation ( source)
- range: documentation ( source)
<?php
function reverse($str) {
$ret = '';
for ($i = mb_strlen($str)-1; $i >= 0; $i--) {
$ret .= mb_substr($str, $i, 1);
}
return $ret;
}
function oddList($x) {
return implode(', ', range(1, $x, 2));
}
echo reverse('abc');