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
Welcome back! If you're the original bug submitter, here's where you can edit the bug or add additional notes.
If this is not your bug, you can add a comment by following this link.
If this is your bug, but you forgot your password, you can retrieve your password here.
Password:
Status:
Package:
Bug Type:
Summary:
From: shri_phadte at yahoo dot co dot in
New email:
PHP Version: OS:

 

 [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 13:01:29 2024 UTC