- preg_match_all: documentation ( source)
- var_export: documentation ( source)
<?php
$re = '/^.{0,11}\S(?!\S)/m';
$str = 'this is a test sentence
this is a test sentence
a
b
c';
preg_match_all($re, $str, $matches);
var_export($matches[0]);