- array_chunk: documentation ( source)
- print_r: documentation ( source)
- explode: documentation ( source)
<?php
$myString = "5.1,3.5,Red,4.9,3,Blue,4.7,3.2,Red,4.6,3.1,Red,5,3.6,Red"; //and so on
$Arr = explode(",", $myString);
$chunks = array_chunk($Arr, 3);
print_r($chunks);