zang8027 Posted July 30, 2008 Share Posted July 30, 2008 ok, so for my portfolio, I have a php site. What i want to know is how to only show a certain part of what the user submitted (credit card) So say the user put in 1234567 as his or her credit card number. On the confirmation page, I want it to say: XXXXX67 How can I do that ??? Link to comment https://forums.phpfreaks.com/topic/117278-xxxxxxxx1234/ Share on other sites More sharing options...
ratcateme Posted July 30, 2008 Share Posted July 30, 2008 use substr() $card = "xxxxx".substr($card_num,5,2); Scott. Link to comment https://forums.phpfreaks.com/topic/117278-xxxxxxxx1234/#findComment-603269 Share on other sites More sharing options...
derekmcd Posted July 30, 2008 Share Posted July 30, 2008 $cardnum = "XXXXXX".substr($_POST['creditcard_num'], -2); Link to comment https://forums.phpfreaks.com/topic/117278-xxxxxxxx1234/#findComment-603273 Share on other sites More sharing options...
vikramjeet.singla Posted July 30, 2008 Share Posted July 30, 2008 you can try this as well: $var = "4111111111111111"; print str_repeat("x", strlen($var)-4).substr($var, strlen($var)-4, strlen($var)); Link to comment https://forums.phpfreaks.com/topic/117278-xxxxxxxx1234/#findComment-603274 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.