Use double quotes. "test\n"
will work just fine (Or, use 'test' . PHP_EOL
).
If the string is enclosed in double-quotes (“), PHP will interpret more escape sequences for special characters:
More Related Contents:
- Pass a PHP string to a JavaScript variable (and escape newlines) [duplicate]
- How to replace different newline styles in PHP the smartest way?
- Writing a new line to file in PHP (line feed)
- PHP Echo Line Breaks
- PHP Regex: How to match \r and \n without using [\r\n]?
- New lines (\r\n) are not working in email body
- PHP new line break in emails
- fputcsv and newline codes
- Pass a PHP variable to a JavaScript variable
- PHP: trying to create a new line with “\n”
- How to replace all XHTML/HTML line breaks () with new lines?
- remove new line characters from txt file using php
- How to handle newlines in Javascript? (from PHP)
- Detect Browser Language in PHP
- How to hide config files from direct access?
- Mysqli update throwing Call to a member function bind_param() error [duplicate]
- What is the purpose of the question marks before type declaration in PHP7 (?string or ?int)?
- Reference – Composer error “Your PHP version does not satisfy requirements” after upgrading PHP
- proper way to logout from a session in PHP
- What is the best way to validate a credit card in PHP?
- The image cannot be displayed because it contains errors
- How do I continue a session from one page to another with PHP
- PHP: Count a stdClass object
- UTF-8 safe equivalent of ord or charCodeAt() in PHP
- Compare two 2D arrays & get intersection and differences
- Dynamically generating a QR code with PHP [closed]
- Finding free blocks of time in mysql and php?
- A __construct on an Eloquent Laravel Model
- UTF-8 not working in HTML forms
- Laravel 5.3 withCount() nested relation