<?php
function remove_char(string $s):string
{
settype($s, 'string');
$pieces = str_split($s);
unset($pieces[0]);
$numb = count($pieces);
unset($pieces[$numb - 1]);
echo implode("", $pieces);
}
$lotsp = "lotsp";`enter code here`
remove_char($lotsp);
?>
The function 'remove_char()' supposed to bring 'String' type of output. However it is outputting anything other than string.
Error: FATAL ERROR Uncaught TypeError: Return value of remove_char() must be of the type string, none returned in /home4/phptest/public_html/code.php70(5) : enter code here
I don't know where is the problem. Any help is greatly appreciated. Thanks