PHP Classes

File: PHP_toolbucket/SoftMoon/lbreak_at.php

Recommend this page to a friend!
  Classes of Joseph  >  Rainbow Maker  >  PHP_toolbucket/SoftMoon/lbreak_at.php  >  Download  
File: PHP_toolbucket/SoftMoon/lbreak_at.php
Role: Auxiliary script
Content type: text/plain
Description: PHP utility function
Class: Rainbow Maker
Create transparent gradient images
Author: By
Last change:
Date: 10 years ago
Size: 603 bytes
 

Contents

Class file image Download
<?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 : ""); }

?>