src/mako/utility/Str.php
public static function mask(string $string, int $visible = 3, string $mask = '*'): string
	{
		if($visible === 0)
		{
			return str_repeat($mask, mb_strlen($string));
		}

		$visible = mb_substr($string, -$visible);

		return str_pad($visible, (mb_strlen($string) + (strlen($visible) - mb_strlen($visible))), $mask, STR_PAD_LEFT);
	}
public static function mask(string $string, int $visible = 3, string $mask = '*'): string
	{
		if($visible === 0)
		{
			return str_repeat($mask, mb_strlen($string));
		}

		$visible = mb_substr($string, -$visible);

		return str_pad($visible, (mb_strlen($string) + (strlen($visible) - mb_strlen($visible))), $mask, STR_PAD_LEFT);
	}
public static function mask ( string $ string , int $ visible = 3 , string $ mask = '*' ) : string { if ( $ visible === 0 ) { return str_repeat ( $ mask , mb_strlen ( $ string ) ) ; } $ visible = mb_substr ( $ string , - $ visible ) ; return str_pad ( $ visible , ( mb_strlen ( $ string ) + ( strlen ( $ visible ) - mb_strlen ( $ visible ) ) ) , $ mask , STR_PAD_LEFT ) ; }
Returns a masked string where only the last n characters are visible.

@param  string $string  String to mask
@param  int    $visible Number of characters to show
@param  string $mask    Character used to replace remaining characters
@return string
Returns a masked string where only the last n characters are visible .