There are two variables containing a string. $ title contains a title; $ text contains text.

tried like this $title.'<br>'.$text docked from and between put <br> but this is not it. And so $title.\n.$text error

Using br does not work if I want to put these variables in a textarea which tags do not accept. In general, the task is to transfer the text line by line, but without the use of tags. Yes, there are many other options where I need the text to be transferred, but there were no tags, the same crosspost where the line of text goes clean, with hyphenation and other things, but without tags. For example, here the text is transferred in rows, but there are no tags. enter image description here

  • $title."\n".$text - vp_arth
  • And so it came out: Title \ nDescription - Evgeny Shevtsov

2 answers 2

Use PHP_EOL , like this

 <textarea rows="10" cols="45"><?php echo $title.PHP_EOL.$text ?></textarea> 
  • thanks, that is necessary - Evgeny Shevtsov

nl2br() is friends with textarea :

 <?=nl2br("$title\n$text");?>