Timeline for answer to When do I use the PHP constant "PHP_EOL"? by Adam Bellaire
Current License: CC BY-SA 3.0
Post Revisions
14 events
| when toggle format | what | by | license | comment | |
|---|---|---|---|---|---|
| Feb 21, 2018 at 14:02 | history | edited | Félix Adriyel Gagnon-Grenier | CC BY-SA 3.0 |
Clarified the answer: it would let think that PHP_EOL would find any endline character on any system in any situation, which is far from true.
|
| Dec 20, 2017 at 9:35 | comment | added | Peter |
There should be an official documentation for PHP_EOL on php.net. Searching for PHP_EOL does not provide direct landing page ( php.net/manual-lookup.php?pattern=php_eol&scope=quickref ). There exists just the info @MichaelJ.Calkins indicated above ( php.net/manual/en/reserved.constants.php ).
|
|
| Nov 16, 2017 at 1:50 | history | edited | user149341 | CC BY-SA 3.0 |
PHP never ran on Classic Mac OS, which is what "Mac" line endings refer to
|
| Aug 29, 2017 at 20:40 | history | edited | John | CC BY-SA 3.0 |
added 2 characters in body
|
| Nov 10, 2016 at 10:13 | comment | added | Nabi K.A.Z. |
but don't use PHP_EOL for data posted from form.
|
|
| May 28, 2016 at 19:32 | comment | added | Heroselohim | "for the local system" should be included, but I think anyone knows that. | |
| Aug 23, 2015 at 11:43 | comment | added | user1854856 | No, I don't think your answer is correct. You generate code on one system but send the output to another system. PHP_EOL, however, tells you the line ending delimiter ONLY for the system where it is used. It does not guarantee you that the other system uses the same delimiter. See my answer below. | |
| Nov 17, 2013 at 2:43 | comment | added | Michael J. Calkins | This is why in Sublime Text or whatever IDE you use you have the option of using 3 different end of lines, Unix, OSX, DOS, or auto. The correct 'End Of Line' symbol for this platform. Available since PHP 4.3.10 and PHP 5.0.2. php.net/manual/en/reserved.constants.php | |
| Sep 13, 2012 at 19:12 | comment | added | Chris Baker | @Stann - What the "big projects" that you know about do is hardly the deciding factor on best practice, let alone what is or is not useful. I maintain a "big project" that is deployed in part on several hosts, including some windows servers. Don't assume -- the constants don't hurt anything, and are a perfectly valid way to write platform-neutral code. Your comments to the contrary are somewhat absurd. | |
| Jul 22, 2011 at 17:59 | comment | added | middus | @Andre Maybe because your deployment platform is Windows Azure? | |
| Mar 4, 2011 at 10:52 | comment | added | Cylindric | @Andre: How about anyone that writes apps to be installed, used and deployed by others? Are you suggesting these should all limit their "supported platforms" to *nix? | |
| Aug 24, 2009 at 21:32 | vote | accept | Christian Oudard | ||
| Sep 24, 2008 at 17:37 | comment | added | Thomas Owens | Should it be used as the end-line character when writing a command-line script? | |
| Sep 24, 2008 at 17:35 | history | answered | Adam Bellaire | CC BY-SA 2.5 |