<?php
Function lbreak_at($Llen, $terminator, $string, $EOLflag=TRUE, $LBr="\n", $atEnd=FALSE) { $SLen=strlen($string); $TLen=strlen($terminator); $lastp=0; do { if (($p=strpos($string, $terminator, $lastp))!==FALSE) $p+=$TLen; else $p=$SLen; $build=substr($string, $lastp, $p-$lastp); $lastp=$p; if (strlen($buildup)+strlen($build)<=$Llen) $buildup.=$build; else { if ($EOLflag) $rtrnString.=$buildup.$LBr; else $rtrnString.=substr($buildup, 0, strlen($buildup)-$TLen).$LBr; $buildup=$build; } } while ($p<$SLen); return $rtrnString.$buildup.($atEnd ? $LBr : ""); }
?>
|