<?php
function textwrap($text, $wrap=80, $break= '<BR>\n'){
$len = strlen($text);
if ($len > $wrap){
$h = '';
$lastWhite = 0;
$lastChar = 0;
$lastBreak = 0;
while ($lastChar < $len){
$char = substr($text, $lastChar, 1);
if (($lastChar - $lastBreak > $wrap) && ($lastWhite > $lastBreak)){
$h .= substr($text, $lastBreak, ($lastWhite - $lastBreak)) . $break;
$lastChar = $lastWhite + 1;
$lastBreak = $lastChar;
}
/* You may wish to include other characters as valid whitespace... */
if ($char == ' ' || $char == chr(13) || $char == chr(10)){
$lastWhite = $lastChar;
}
$lastChar = $lastChar + 1;
}
$h .= substr($text, $lastBreak);
}
else{
$h = $text;
}
return $h;
}
?>
<HTML>
<HEAD><TITLE>Textwrap Example</TITLE></HEAD>
<BODY>
<?php
$test = "This is a test. This is only a test. Had this
been a real emergency you would have been instructed to put your head between your
knees and pray.";
echo( "$test<BR>\n<BR>\n");
for ($w = 80; $w > 0; $w = $w - 10){
$wrapped = textwrap($test, $w);
echo( "$w<BR>\n$wrapped<BR>\n<BR>\n");
}
?>
</BODY>
</HTML>
phpAds, a complete banner and ad management system with detailled tracking and stats. Categories : MySQL , Complete Programs , Ecommerce , PHP , Databases Point and Click Interface ala MS Access for creating SQL statements. Categories : MySQL , Complete Programs , General SQL , PHP , Databases Expose - PHP template engine, supports server and client-sided caching,a plugin system, multiple languages, template script language is based on PHP itself. Categories : PHP , PHP Classes , Templates , Complete Programs Finds files on your site, uses UNIX find command. Categories : Complete Programs , Filesystem , PHP Accepts a database & hostname from a user and then HTTP username and password. Uses this to connect to a MySQL database. Produces a form based on the tables it finds there to allow the user to do SELECTs, INSERTs, and DELETEs. Categories : Databases , PHP , MySQL , Complete Programs Create and restore backup of MySQL databases Categories : MySQL , Databases , PHP , PHP Classes , Complete Programs Example voting script. Lets people enter suggestions and vote for existing ones. Categories : MySQL , PHP , Cookies , Complete Programs , Databases Rich Editor (RE) is a cross-browser WYSIWYG html editor Categories : Content Management , Editors and IDEs , PHP , Complete Programs Functions to access a NNTP/NNRP newsserver. Complete set with examples is at ftp://ftp.nederland.net/pub/nnrplib Categories : Search , PHP , Complete Programs free, search engine, indexing, system, information, web,
ftp, http, free, software, cgi, php, MySQL, database, php3,
FreeBSD, Linux, Unix, UdmSearch Categories : MySQL , Complete Programs , PHP , Databases , Search ClassFuncDoc - This script is a classes and functions documentation tool. Categories : PHP , Classes and Objects , Documentation , PHP Classes , Complete Programs Free For All Links Page using PHP3 and Mysql Categories : PHP , MySQL , Complete Programs phpCards - PHP/mySQL postcard script with web based admin to add, edit, and delete cards and categories. Very easy to install. Categories : PHP , Complete Programs , HTML and PHP , MySQL A simple and fast calendar combining PHP and tables. Use this as a base for applications in which a calendar is needed. Categories : Date Time , PHP , Complete Programs , Calendar Disk Usage, uses UNIX du command. Categories : Complete Programs , PHP , Filesystem