- fgets: documentation ( source)
- fopen: documentation ( source)
<?php
function FirstReverse($str) {
$length = strlen($str)-1;
$rstr = NULL;
for ($i = $length; $i > -1; $i--) {
$rstr .= $str[$i];
}
// code goes here
return $rstr;
}
// keep this function call here
// to see how to enter arguments in PHP scroll down
echo FirstReverse(fgets(fopen('php://stdin', 'r')));