note 74553 added to function.explode
| From: | orenivr at gmail dot com | Date: | Tue, 17 Apr 2007 08:27:11 +0000 |
| Subject: | note 74553 added to function.explode | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-125491@lists.php.net to get a copy of this message | ||
The function bellow split paragraph to several lines
Oren Wisman
<?php
function paragraphsplit($str,$lensize=24)
{
$words=explode(" ",$str);
$paragraph=array();
$ib=0;
for($i=0;$i<=count($words);$i++)
{
if (strlen($paragraph[$ib].$words[$i])>$lensize) $ib++;
$paragraph[$ib]=$paragraph[$ib]." ".$words[$i] ;
}
return $paragraph;
}
$message="simple function to remove words if more than max allowed words or add a charcter
";
$paragraph=paragraphsplit($message) ;
for($i=0;$i<count($paragraph);$i++)
{
echo "{$paragraph[$i]}<br>";
}
?>
----
Server IP: 192.117.122.43
Probable Submitter: 213.8.172.3
----
Manual Page -- http://www.php.net/manual/en/function.explode.php
Edit -- https://master.php.net/note/edit/74553
Del: integrated -- https://master.php.net/note/delete/74553/integrated
Del: useless -- https://master.php.net/note/delete/74553/useless
Del: bad code -- https://master.php.net/note/delete/74553/bad+code
Del: spam -- https://master.php.net/note/delete/74553/spam
Del: non-english -- https://master.php.net/note/delete/74553/non-english
Del: in docs -- https://master.php.net/note/delete/74553/in+docs
Del: other reasons-- https://master.php.net/note/delete/74553
Reject -- https://master.php.net/note/reject/74553
Search -- https://master.php.net/manage/user-notes.php