Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

Converting CC Info into a a new xxxx-xxx string

Posted on 2007-11-23
1
Medium Priority
?
639 Views
Last Modified: 2008-02-01
I have a credit card number I grab from the database. I need to convert this string into a format where all digits become an x, except for the last four digits. any ideas how to do this? Thanks!
0
Comment
Question by:jcbodyworks
1 Comment
 
LVL 20

Accepted Solution

by:
steelseth12 earned 2000 total points
ID: 20341490
$card = "4111111111114321";
      
      $card = "xxxxxxxxxxxx".substr($card,-4);

      print $card;
      
      ### OR ###
      
      
      $card = "4111-1111-1111-4321";
      
      $card = "xxxx-xxxx-xxxx-".substr($card,-4);

      print $card;
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
Originally, this post was published on Monitis Blog, you can check it here . In business circles, we sometimes hear that today is the “age of the customer.” And so it is. Thanks to the enormous advances over the past few years in consumer techno…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

926 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question