A
A
Alexey2016-01-20 23:26:35
PHP
Alexey, 2016-01-20 23:26:35

How to store line breaks?

Hello! Any advice on the best way to store line breaks in the database? First, replace \n with <br>and store in the database already <br>or store as sent in the form, and then insert the tag <br>instead of \n when generating the page

Answer the question

In order to leave comments, you need to log in

1 answer(s)
D
DevMan, 2016-01-20
@dzheka3d

it all depends on what and how this text is used.
if the task is accepted once from the form and then displayed many times on the page, then it makes sense to replace \n with br when saving.
although all this is saving on matches.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question