Skip to content

Instantly share code, notes, and snippets.

@voidnerd
Created September 11, 2018 15:28
Show Gist options
  • Save voidnerd/dee663af4bae51fdc143209527f12957 to your computer and use it in GitHub Desktop.
Save voidnerd/dee663af4bae51fdc143209527f12957 to your computer and use it in GitHub Desktop.
<?php
function encrypt($str, $num){
$len = strlen(substr($str, $num, strlen($str) - $num));
$goin = str_repeat('*', $len);
$res = substr($str, 0 , $num) .$goin . substr($str, $len, strlen($str));
return $res;
}
print(encrypt("1111111111111111111111", 4)); //1111******************1111
?>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment