Here is the one i wrote sometime ago
class TStringBuilder {
private $str = null;
public function __construct()
{
$this->str = array();
}
public function add($str)
{
$this->str[] = $str;
}
public function clear() {
$this->str = array();
}
public function get() {
$this->str;
}
public function dump($seperator = "") {
$retVal = "";
foreach($this->str as $k) {
$retVal .= $k . $seperator;
}
return substr($retVal, 0, strlen($retVal) - strlen($seperator));
}
public function count() {
return count($this->str);
}
public function length() {
$retVal = 0;
foreach($this->str as $k) {
$retVal += strlen($k);
}
return retVal;
}
}