dreamci Posted July 13, 2008 Share Posted July 13, 2008 hello , i want to ask how to convert 5658458756488067 to this number: 5xxxxxxxxxxx8067 i will use it to hide credit card details. thanks (there is 16 letters) Link to comment https://forums.phpfreaks.com/topic/114526-solved-replacing-characters/ Share on other sites More sharing options...
sader Posted July 13, 2008 Share Posted July 13, 2008 maybe like this <?php $num = "1234567890123456"; for($i=1; $i<12; $i++)$num[$i]='x'; echo $num; ?> Link to comment https://forums.phpfreaks.com/topic/114526-solved-replacing-characters/#findComment-588918 Share on other sites More sharing options...
teynon Posted July 13, 2008 Share Posted July 13, 2008 preg_replace("@^(\d)(\d{11})(\d{4})$@", "$1xxxxxxxxxxx$3", $card); Link to comment https://forums.phpfreaks.com/topic/114526-solved-replacing-characters/#findComment-588921 Share on other sites More sharing options...
dreamci Posted July 13, 2008 Author Share Posted July 13, 2008 thank you guys both works.. Link to comment https://forums.phpfreaks.com/topic/114526-solved-replacing-characters/#findComment-588922 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.