Jump to content

Recommended Posts

I had an idear it was wordwrap can you kindly exsplain what the 1 for cheers.

<?

$word=array("12345678901234567890123456789012345678901234567890123324342343");

foreach($word AS $a);

$result=wordwrap($a,50,"<br>",1);

echo $result;

?>
I got word wrap working cheers.

this word wrap is for making a brake or new line i also was wanting substr ok but cheers.

ps. if you know of a way to get word wrap to preform like substr show me cheers.

$word=array("11111111112222222222");

foreach($word AS $a);

$result=wordwrap($a,10,"<br>",1);

echo $result;


For example say i wanted to show the first 10 numbers only can word wrap do it? .
can someone show me kindly what i done wrong please cheers.

<?

$word=array("11111111112222222222");


for($i=0; $i<count($word); $i++){

$word=$word[$i];
}

$text = "$word";

echo ShortenString($text);

function ShortenString($text)

{

// Number of characters you want to display

$num_chars = 19;

$text = $text." ";

$text = substr($text,0,$num_chars);

$text = substr($text,0,strrpos($text,' '));

return $text;

}

?>
This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.