Answer the question
In order to leave comments, you need to log in
Php, Remove First and Last Character task with codewars, how to solve the problem?
I'm solving a problem on codewars - Remove First and Last Character. You need to remove the first and last character in a string.
PHP7.0 runtime.
My decision:
function remove_char(string $s): string {
$result = substr($s, 1, -1);
return $result;
}
Answer the question
In order to leave comments, you need to log in
Maybe you should use mb_substr? Who knows what lines they check on
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question