How to move part of text to another line in php?

Member

by rollin , in category: PHP General , 9 months ago

How to move part of text to another line in php?

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

by filiberto , 9 months ago

@rollin 

In PHP, you can use the newline character " " to move part of text to another line. Here is an example:

1
2
3
4
5
$text = "Hello, this is some text that I want to move to a new line.";
$newText = substr_replace($text, "
", 18, 0); // Move the text starting from position 18 to a new line

echo $newText;


This will output:

1
2
Hello, this is some
 text that I want to move to a new line.