PHP Interview Questions(18)

面试时间:2020-02-20,星期四,上午 10:30。


1. 怎么获取字符串倒数第二个字符。

function getSecondLastChar($string) {
    $length = strlen($string);

    if ($length >= 2) {
        return $string[$length - 2];
    } else {
        return '';
    }
}
function getSecondLastChar($string) {
    return $string[-2];
}

2.常用的框架 区别

256 total views, 1 views today

Leave a Reply

Your email address will not be published. Required fields are marked *