How do I use nl2br() in Laravel 5 Blade

You can define your own “echo format” that will be used with the regular content tags {{ … }}. The default format is e(%s) (sprintf is used to apply the formatting) To change that format call setEchoFormat() inside a service provider: public function boot(){ \Blade::setEchoFormat(‘nl2br(e(%s))’); } Now you can just use the normal echo tags: … Read more

\n vs. PHP_EOL vs. ?

DOS, Unix, and Mac (pre-OS X and OS X) all use different characters or character combinations to represent “go to the next line.” DOS – Uses a CR+LF (that’s ASCII 13 followed by an ASCII 10, or \r\n) to represent a new line. Unix – Uses an LF (that’s ASCII 10, or \n) to represent … Read more

How can I replace newline or \r\n with ?

There is already the nl2br() function that inserts <br> tags before new line characters: Example (codepad): <?php // Won’t work $desc=”Line one\nline two”; // Should work $desc2 = “Line one\nline two”; echo nl2br($desc); echo ‘<br/>’; echo nl2br($desc2); ?> But if it is still not working make sure the text $desciption is double-quoted. That’s because single … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)