$string= 2013-01-0112:00:002013-01-0212:00:002013-01-0312:00:00
我想得到
$nexstring= 2013-01-0112:00:00,2013-01-0212:00:00,2013-01-0312:00:00//comma each 18 chars
使用str_split
:
$chunks = str_split($string, 18);
$nexstring = join(',', $chunks);
$nextString = implode(
',',
str_split($string, 18)
);
我认为您可以使用自动换行功能,而不是拆分字符串。
$nexstring = wordwrap($nexstring, 18, ',', true);