Simple function below generates credit card like random IDs.


Function


function getCreditCardNumbers($segments = 4) {
$numbers = [];
for ($i = 0; $i < $segments; $i++) {
$numbers[] = mt_rand(1000, 9999);
}

return implode('-', $numbers);
}

echo getCreditCardNumbers();

Result


5951-9961-7050-7183
8402-4921-5497-9251
9986-3340-7152-2866