Quantcast
Channel: Active questions tagged linefeed+php - Stack Overflow
Browsing latest articles
Browse All 21 View Live

PHP: Is it ok to replace \r\n with \n?

I have a form with a textarea and a JS character counter. Yet the backend script claims that the strlen of the message is longer than the JS character counter claimed. The reason for this, I have...

View Article



Line feed is showing up unexpectedly in PHP

I have spent the last several hours pulling my hair out trying to figure out the solution to this problem. I am sending an AJAX request which, up until some minor changes, worked perfectly, returning...

View Article

Php file download is putting two lines with a line feed at the top

I have a script that receives a parameter then downloads a file to the clients browser. The file is not located in a folder accessible under the docent root When my script executes pdf's work fine but...

View Article

How to preg_replace from indentifier to end of text with CR(LF) characters

I'm trying to split a piece of text (actually html) into two pieces, a top and bottom part. An 'identifier' (<--#SPLIT#-->) in the text marks the position to split. To get the upper part I have...

View Article

For PHP, how to read in correct lines from CSV file with LF in some CSV text...

Input csv file (note: there's a non-printable LF character \n after fruit): 1,"apple", "水果fruit\n",300 2,"donut", "甜點dessert",200 My PHP program: function wpa(&$arr) { echo nl2br(print_r($arr,...

View Article


Change line feed of csv file to the same one

I need to work with csv files. I want to write an web app which is working with csv files and is written in php. Problem is all the csv files have diffrent line feeds /r, /n,/r/n/. I need to have the...

View Article

PHP: \r character being ignored

I have a string $s="one\rtwo\rthree\rfour\rfive" and when I do print $s I expect to see five only because the linefeed resets the line. Instead I seem to be seeing one two three four five. What's...

View Article

Image may be NSFW.
Clik here to view.

Carriage return and line feed

I got stuck with carriage return and line feed problem. When I run my script it shows CR,LF inside double quote of last field and there is another LF after than, realistically CR,LF should be outside...

View Article


PhpStorm - new lines (linefeed) are being removed when saving to remote server

Using PhpStorm 2017.1.4 I have a MySQL query string in PHP: <php $MySQL_Query_String = "SELECT * FROM `VISITOR` WHERE `ID` =3 -- eventually add the date order here as well ORDER BY...

View Article


How to insert \n character in MySQL table from PHP form

I am trying a few hours now to add the character \n in a MySQL table. I have a form. If someone presses OK with no data given i want to pass in the table tha character \n. I have tried this....

View Article

Adding carriage return to each line [duplicate]

This question already has an answer here: PHP - how to create a newline character? 13 answers I have a result from a query which I am writing to a file. I want the file to list the rows vertically...

View Article

What does exactly mean by 'Line feeds' in HTML and PHP? How do they are added...

I was reading PHP Manual and I come across following text paragraph : Line feeds have little meaning in HTML, however it is still a good idea to make your HTML look nice and clean by putting line...

View Article

Which "trailing newline" the PHP manual is talking about? It's just confusing...

I'm reading the PHP manual. I come across a sentence on the manual page(URL : Instruction separation). There is the first paragraph on this page saying : As in C or Perl, PHP requires instructions to...

View Article


Does omitting the closing tag of a PHP block at the end of a file remove any...

I'm using PHP 7.1.12 I know that the closing tag of a block of PHP code automatically implies a semicolon so we do not need to have a semicolon terminating the last line of a PHP block. The closing...

View Article

In PHP in Windows, do 'linefeed (LF)' and 'carriage return (CR)' mean the...

This question already has an answer here: Difference between CR LF, LF and CR line break types? 9 answers I'm using PHP 7.2.10 I'm using Windows 10 Home Single Language 64-bit Operating System I tried...

View Article


How does source code manage white space and concatenation [duplicate]

This question already has an answer here: How to combine two strings together in PHP? 17 answers PHP parse/syntax errors; and how to solve them? 17 answers In the following code: $email_body =...

View Article

Writing a new line to file in PHP (line feed)

My code: $i = 0; $file = fopen('ids.txt', 'w'); foreach ($gemList as $gem) { fwrite($file, $gem->getAttribute('id') . '\n'); $gemIDs[$i] = $gem->getAttribute('id'); $i++; } fclose($file); For...

View Article


Image may be NSFW.
Clik here to view.

PHP: Telegram Bot: Insert line break to text message

"\n" and "\r\n", tested in text message sent by telegram bot, to create line break. Instead of showing line break, underline _ will appear after using them. How I could printing line feed in telegram...

View Article

Match all instances of \r\n, except that occurring before the very end of the...

Using preg_replace, I need to define the regex PATTERN to match all instances of the newline sequence \r\n exactly, EXCEPT that occuring at the very end of the...

View Article

How do remove unwanted linefeed charachter from file-download in Laravel Nova?

In a Laravel Nova application i've got a strange issue: Whenever i try to download a file i have a linefeed char on the first line (0A, an empty line). This corrupts images, zip-files and so on. But...

View Article

Line-feed is identified as Windows style, despite using \n

I'm creating on-the-fly a CSV file to download via a hyperlink, using the following code: $content = <<<ENDdata:text/csv;charset=utf-8,\xEF\xBB\xBF"Date","Number of items sold","Number of...

View Article

Browsing latest articles
Browse All 21 View Live




Latest Images