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

Member

by rollin , in category: PHP General , a year ago

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

Facebook Twitter LinkedIn Telegram Whatsapp

1 answer

by filiberto , a year 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.


Related Threads:

How to exclude part of the text via regex in php?
How to move migration to another project on laravel?
How to add arrays to another array with php?
How to draw text with line on canvas?
How to align a text and a image with bottom-line in html?
How to append text to a line in d3.js