If you need a function to cut only words longer than N characters, feel free to use the function below:
<?php
function wrap($str, $width=75, $break="\n") {
return preg_replace('#(\S{'.$width.',})#e', "chunk_split('$1', ".$width.", '".$break."')", $str);
}
echo wrap('aaaa bbb cc dddd-dddd', 3, ' ');
?>
The above example will output: "aaa a bbb cc ddd d-d ddd "
--was--
If you need a function to cut only words longer than N characters, feel free to use the function below:
<?
function wrap($str, $width=75, $break="\n") {
return preg_replace('#(\S{'.$width.',})#e', "chunk_split('$1', ".$width.", '".$break."')", $str);
}
echo wrap('aaaa bbb cc dddd-dddd', 3, ' ');
?>
The above example will output: "aaa a bbb cc ddd d-d ddd "
http://php.net/manual/en/function.wordwrap.php
lmpx.com only provides a reader for public news (NNTP) servers. It is not
affiliated with the servers or forums shown here and is not responsible for
the content of articles, which is written by their respective authors.