Timeline for When do I use the PHP constant "PHP_EOL"?
Current License: CC BY-SA 3.0
Post Revisions
28 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Sep 16, 2024 at 4:34 | comment | added | developer981 | @Wiimm by "windows script" what do you mean? A PHP script that is running on Windows at the time? PHP_EOL will be the EOL for wherever it's running. I don't understand your comment. | |
| Nov 17, 2023 at 20:42 | history | edited | CommunityBot |
replaced http://us3.php.net with https://www.php.net
|
|
| Sep 7, 2022 at 10:58 | comment | added | Wiimm |
@MattSmith If you write a script, then you have to follow the script rules and not the end-of-line of the current system. If writing a bash script, then use \n, if you writing a windows script, then use \r\n. Both are independent from the current system and from PHP_EOL.
|
|
| Jul 16, 2022 at 9:29 | comment | added | Matt Smith |
I use PHP_EOL when writing scripts to execute and output in a command line terminal - so I know I can force a new line in text output in the terminal. For web applications I'd output <br> to force text to a new line (or wrap a block element around the content, like a paragraph or div). So I think answers should clarify the context of the PHP script (terminal application, web application, file creation script etc.) to support the argument for/against the use of PHP_EOL.
|
|
| Nov 5, 2019 at 4:44 | answer | added | hamish | timeline score: 2 | |
| Mar 10, 2019 at 9:16 | answer | added | Alessandro | timeline score: 0 | |
| Mar 15, 2018 at 14:08 | comment | added | donquixote | I think there is a lot of misleading advice in the upvoted answers on this page. If you run a script on two different platforms, then compare the output or generated data (log files, html page, database records etc), then the PHP_EOL will result in a mismatch in the diff. In most cases this is not what you want. | |
| Aug 23, 2015 at 11:35 | answer | added | user1854856 | timeline score: 13 | |
| Oct 18, 2014 at 11:11 | history | edited | Pacerier | CC BY-SA 3.0 |
deleted 129 characters in body
|
| Jul 18, 2014 at 8:16 | answer | added | intTiger | timeline score: 2 | |
| May 15, 2013 at 11:20 | answer | added | Iain Collins | timeline score: 15 | |
| Mar 13, 2013 at 11:54 | answer | added | Vasu_Sharma | timeline score: 1 | |
| Jan 7, 2013 at 13:06 | answer | added | Salman Arshad | timeline score: 24 | |
| Jul 12, 2011 at 15:15 | answer | added | AlexV | timeline score: 106 | |
| Apr 14, 2011 at 2:58 | history | edited | hippietrail |
edited tags
|
|
| Feb 9, 2011 at 11:03 | answer | added | SjH | timeline score: 4 | |
| Jan 14, 2011 at 17:15 | answer | added | Nica Mlg | timeline score: 3 | |
| Oct 4, 2010 at 7:59 | answer | added | ip bastola | timeline score: 10 | |
| May 18, 2010 at 2:20 | answer | added | Allan | timeline score: 0 | |
| Dec 11, 2009 at 1:17 | answer | added | user226801 | timeline score: -2 | |
| Nov 6, 2009 at 18:24 | answer | added | Lex | timeline score: 1 | |
| Sep 8, 2009 at 15:01 | answer | added | chrismacp | timeline score: 3 | |
| Aug 24, 2009 at 21:32 | vote | accept | Christian Oudard | ||
| Jun 22, 2009 at 12:25 | answer | added | Gavin Gilmour | timeline score: 2 | |
| Apr 21, 2009 at 22:06 | answer | added | Edward Z. Yang | timeline score: 6 | |
| Sep 24, 2008 at 19:35 | answer | added | Zoredache | timeline score: 88 | |
| Sep 24, 2008 at 17:35 | answer | added | Adam Bellaire | timeline score: 429 | |
| Sep 24, 2008 at 17:34 | history | asked | Christian Oudard | CC BY-SA 2.5 |