Jump to content

Add x every Nth of $needle?


aebstract

Recommended Posts

Not sure this will work, but it's where I would start:

$str_array = explode(",", $unformatedString)
for ($i = 1; $i <= array_count($str_array); $i++){
if (isnumeric($i / 4) && $str_array[$i-1] != '\n'){
array_splice($str_array, $i-1, 0, '\n');
$i = 1
}
}
$unformatedReturn = implode(",", $str_array);

 

 

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.