Jump to content

edit is this code correct does not work substr cheers.


redarrow

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;

}

?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • 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.