Jump to content


Photo

edit is this code correct does not work substr cheers.


  • Please log in to reply
10 replies to this topic

#1 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 24 July 2006 - 12:22 AM

how do i add a brake from the database when echo the letters out.

so if there was a sentence with 200 letters how do i get a brake in there afther 50 letters cheers.
Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#2 trq

trq
  • Staff Alumni
  • Advanced Member
  • 31,041 posts

Posted 24 July 2006 - 12:26 AM

wordwrap() might help you.

#3 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 24 July 2006 - 12:41 AM

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;

?>

Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#4 trq

trq
  • Staff Alumni
  • Advanced Member
  • 31,041 posts

Posted 24 July 2006 - 12:50 AM

can you kindly exsplain what the 1 for cheers

The manual does a fine job of explaining it. What more can I say?

#5 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 24 July 2006 - 01:06 AM

Is there a php statement that i can work out how to have only the amount of charecters i wont cheers.

Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#6 trq

trq
  • Staff Alumni
  • Advanced Member
  • 31,041 posts

Posted 24 July 2006 - 01:08 AM

Please explain?

#7 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 24 July 2006 - 01:17 AM

i wont to find a way to specefi how many charecters to show from the database.

i wont to learn the code properly but i wont to use if possable a php statement like the wordwrap easy and stright foward.
Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#8 trq

trq
  • Staff Alumni
  • Advanced Member
  • 31,041 posts

Posted 24 July 2006 - 01:35 AM

Um... ive allready pointed you to the wordwrap manual twice. What part don't you understand?

#9 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 24 July 2006 - 01:56 AM

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? .
Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc

#10 trq

trq
  • Staff Alumni
  • Advanced Member
  • 31,041 posts

Posted 24 July 2006 - 02:46 AM

For example say i wanted to show the first 10 numbers only can word wrap do it?

No... use substr().

#11 redarrow

redarrow
  • Members
  • PipPipPip
  • Advanced Member
  • 7,308 posts
  • Locationlondon

Posted 24 July 2006 - 03:47 AM

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;

}

?>
Wish i new all about php DAM i will have to learn
((EMAIL CODE THAT WORKS))
http://simpleforum.ath.cx/mail2.inc
((PAYPAL INTEGRATION THAT WORKS))
http://simpleforum.a...aypal1_info.inc




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users