Should be...
$match = substr($string, -7);
... without the final -1. But in fact, it's far better done with...
$result = substr($string, 0, -7) . str_repeat('#', 7);
... or, more generic:
$coverWith = function($string, $char, $number) {
return substr($string, 0, -$number) . str_repeat($char, $number);
};
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…