php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #35441 Newline replace behaves different in Windows and linux
Submitted: 2005-11-28 12:17 UTC Modified: 2005-11-28 12:35 UTC
From: shri_phadte at yahoo dot co dot in Assigned:
Status: Not a bug Package: *General Issues
PHP Version: 5.1.0 OS: Windows/Linux
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
47 - 27 = ?
Subscribe to this entry?

 
 [2005-11-28 12:17 UTC] shri_phadte at yahoo dot co dot in
Description:
------------
When I want to replace newline in a string i use str_replace but for Linux i have to code search string as '\n' which is fine but for windows I have to actually press "Enter" in the string to search for and replace a newline in the String. This Happens For The Data Which Have Been Entered Through a HTML Form
eg For Linux
str_replace("\n"," ",$String);

& For Windows
str_replace("
"," ",$String);
Note :after str_replace(" I have actually pressed "Enter" Button on the keyboard


Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-11-28 12:24 UTC] tony2001@php.net
Yeah, on *nix newline is "\n", on Windows it's "\r\n" and on Mac it's "\r".
Use PHP_EOL constant for that.
 [2005-11-28 12:35 UTC] shri_phadte at yahoo dot co dot in
Thanks Tony !!
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sun Apr 28 07:01:30 2024 UTC