Jump to content

[SOLVED] substr_replace() help


DamienRoche

Recommended Posts

I am trying to insert a <br> into a string after 12 characters and then continue the string.

 

Does anybody know a simple way of doing this? I have tried but I can't even get the <br> to show, let alone operate as a tag..

 

Regards,

 

Damien.

 

 

Link to comment
https://forums.phpfreaks.com/topic/122836-solved-substr_replace-help/
Share on other sites

try this:

 

$mystring = "this is my stringstringstring, this is my stringstringstring, this is my stringstringstring";

//without word cut
echo wordwrap($mystring, 12, "<br />\n");

echo "<br /><br />";

//with word cut
echo wordwrap($mystring, 12, "<br />\n", TRUE);

 

more info: http://uk3.php.net/manual/en/function.wordwrap.php

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.