[eluser]jupiter909[/eluser]
Hmmm the long way round. You'd much rather be using regex for things such as verifying credit-card numbers/phone numbers/postal codes.
To change 1234-4567-7890-4433 into xxxx-xxxx-xxxx-4433. is as easy as
Code:
$last_four_digits = substr("$credit_card_number", -4);
$masked = "xxxx-xxxx-xxxx-".$last_four_digits;
Avoid using regex when not needed.