WeberDev.com PHP and MySQL Code

LOG IN
BEGINNER GUIDESPHP CLASSESCODE SEARCHARTICLES SEARCHPHP FORUMSPHP MANUALPHP FUNCTIONS LISTWEB SITE TEMPLATES
Start typing to search for PHP and MySQL Code Snippets and Articles Search
Submit a code Example / Snippet Join us on FaceBook
Submit a code Example / Snippet Submit Your Code
Poker Tournaments Poker Tournaments
Poker Guide for Developers Poker Guide for Developers
Search Engine Optimization Monitor SEO Monitor
Web Site UpTime Monitor UpTime Monitor
Your Personal Examples List My Favorite Examples
Your Personal Articles List My Favorite Articles
Edit Account Info Update Your Profile
PHP Code Search
Web Development Forums
Learn MySQL Playing Trivia
PHPBB2 Templates
Web Development Resources
Web Development Content
Internet Security Software
PHPClasses
PHP Editor
PHP Jobs
Vision.To Design
Ajax Tutorials
PHP Programming Help
PHP/MySQL Programming
Webmaster Resources
Webmaster Forum
XML meta language
website builder
פרייסז - הכח לקנות עובר לידיים שלך
Texas Holdem Poker Evangelists

Go Back Add a Comment Send this example to a friend Add this Article to your personal favoritest for easy future access to your favorite Code Examples and Articles. Submit a code example Print this code example.
BACK ADD A COMMENT SEND TO A FRIEND ADD TO MY FAVORITES ADD CODE EXAMPLES PRINT
Title : Wraps text to any desired width with customizable line break. Defaults are 80 columns and '<BR>\n' Should be trivial to work in 2.0.1 Remove optional arguments to start.
Categories : Complete Programs, PHP Update Picture
Richard Lynch
Date : Jan 17th 1999
Grade : Be the 1st to grade this Code Example
Viewed : 4112
File : No file for this code example.
Images : No Images for this code example.
Search : More code by Richard Lynch
Action : Grade This Code Example
Tools : My Examples List

Submit your own code examples  Submit your own code examples 
 

<?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