Re: [PHP] str_replace new line

2007-07-02 Thread Richard Lynch
On Sat, June 30, 2007 12:04 pm, jekillen wrote: > Hello; > I have the following code: > > $prps = str_replace("\n", ' ', $input[3]); > $request = str_replace("// var purpose = {} ;\n", "var purpose = > '$prps';\n", $request); > > In the first line $input[3] is a string formatted with new lines a

Re: [PHP] str_replace new line

2007-07-02 Thread Jim Lucas
jekillen wrote: On Jul 2, 2007, at 6:07 PM, jekillen wrote: On Jul 2, 2007, at 3:15 PM, Greg Donald wrote: On 6/30/07, jekillen <[EMAIL PROTECTED]> wrote: Hello; I have the following code: $prps = str_replace("\n", ' ', $input[3]); Are you sure $input[3] doesn't have two newlines at th

Re: [PHP] str_replace new line

2007-07-02 Thread jekillen
On Jul 2, 2007, at 6:07 PM, jekillen wrote: On Jul 2, 2007, at 3:15 PM, Greg Donald wrote: On 6/30/07, jekillen <[EMAIL PROTECTED]> wrote: Hello; I have the following code: $prps = str_replace("\n", ' ', $input[3]); Are you sure $input[3] doesn't have two newlines at the end? Why not u

Re: [PHP] str_replace new line

2007-07-02 Thread Greg Donald
On 6/30/07, jekillen <[EMAIL PROTECTED]> wrote: Hello; I have the following code: $prps = str_replace("\n", ' ', $input[3]); Are you sure $input[3] doesn't have two newlines at the end? Why not use trim() to be sure? $request = str_replace("// var purpose = {} ;\n", "var purpose = '$prps

[PHP] str_replace new line

2007-06-30 Thread jekillen
Hello; I have the following code: $prps = str_replace("\n", ' ', $input[3]); $request = str_replace("// var purpose = {} ;\n", "var purpose = '$prps';\n", $request); In the first line $input[3] is a string formatted with new lines at the end of each line. It is to be used to initialize a ja