osx - PHP New line character Windows vs. Macintosh -


for user input this: $var=str_replace(array('\r','\n'),'',$var);

works on windows, removing new lines. however, on mac (+firefox) somehow replaces new lines \ character.

any clues why happens?

i'm surprised works on windows.

usually, php interpret control characters, need in double-quoted strings, eg

array("\r", "\n") 

Comments