You appear to be a bot. Output may be restricted
Description
Given a string, mask it with the * character.
First and last character will remain with the filling characters being changed to *. One Character will be left in tact as is. Two character strings will have the first character remain and the second be a *.
Usage
$string = edd_mask_string( $string );
Parameters
- $string
- ( string ) optional –
Returns
string
Source
File name: easy-digital-downloads/includes/privacy-functions.php
Lines:
1 to 27 of 27
function edd_mask_string( $string = '' ) { if ( empty( $string ) ) { return ''; } $first_char = substr( $string, 0, 1 ); $last_char = substr( $string, -1, 1 ); $masked_string = $string; if ( strlen( $string ) > 2 ) { $total_stars = strlen( $string ) - 2; $masked_string = $first_char . str_repeat( '*', $total_stars ) . $last_char; } elseif ( strlen( $string ) === 2 ) { $masked_string = $first_char . '*'; } return $masked_string; }