- array_map: documentation ( source)
- array_chunk: documentation ( source)
- var_export: documentation ( source)
- preg_split: documentation ( source)
<?php
$string = "Service, Service, Service, 8 mars, 2017, 22 mars, 2017, 5 april, 2017, 08:00, 08:00, 08:00";
$rows = 3;
var_export(
array_map(
null,
...array_chunk(
preg_split('/(?:[A-Z][a-z]+|\d+)\K, /', $string),
$rows
)
)
);