PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!
I am currently extracting information from a database which is a string. What I need to do is extract a few words from the sentence. I currently have 26 characters I can extract from the string that are allowed to go in a html table (first row) then I must put in a html break (<br>) and insert the second 26 characters on a second row from where I left off on the first line. The problem with this is that words get cut off I want whole words to go in the first and second lines. How can I do this?
$news = "Hello this is a long string item that i am inserting in a web page"
for the first line of text
substr($news, 0, 26)
I break (<br>)
for the second line of text
substr($news1, 26, 52)
RESULT which i dont want as word get cut
Hello this is a long strin
g item that i am inserting
I think I've seen a function that does this for you. You just specify where to wrap and it won't wrap on a word. I don't remember the name of it, though. ^^; *looks*
Ah, wordwrap.