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: 12 years ago
Size: 603 bytes


Class file image Download

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;
$rtrnString.=substr($buildup, 0, strlen($buildup)-$TLen).$LBr;
$buildup=$build; } }
    while (
$rtrnString.$buildup.($atEnd ? $LBr : ""); }