I have a TXT file formatting that looks like:
123451234512345
123451234512345
I want to format the file with php in this format:.
12345-12345-12345
12345-12345-12345
This is what I have tried:
$codes = "codes.txt";
$unformatedCode = file($codes, FILE_IGNORE_NEW_LINES);
$abcd = "-";
foreach ($array as $value) {
$text = (string)$unformatedCode;
$arr = str_split($text, "");
$formatedCode = implode("-", $arr);
echo $formatedCode;
}