#35441 [Bgs]: Newline replace behaves different in Windows and linux

From: Date: Mon, 28 Nov 2005 11:35:27 +0000
Subject: #35441 [Bgs]: Newline replace behaves different in Windows and linux
References: 1  Groups: php.bugs 
Request: Send a blank email to php-bugs+get-89193@lists.php.net to get a copy of this message
ID: 35441 User updated by: shri_phadte at yahoo dot co dot in Reported By: shri_phadte at yahoo dot co dot in Status: Bogus -Bug Type: Strings related +Bug Type: *General Issues Operating System: Windows/Linux PHP Version: 5.1.0 New Comment: Thanks Tony !! Previous Comments: ------------------------------------------------------------------------ [2005-11-28 12:24:25] 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:17:05] 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 ------------------------------------------------------------------------ -- Edit this bug report at http://bugs.php.net/?id=35441&edit=1

« previous php.bugs (#89193) next »