Re: [PHP] explode string at new line

2007-06-06 Thread Chris
Jim Lucas wrote: Chris wrote: Davi wrote: Em Terça 05 Junho 2007 23:52, [EMAIL PROTECTED] escreveu: That's exactly correct. Except I /think/ you should use \n instead of '\n'. Thank you for the reply... =) I'll check this... BTW: array explode ( string $delimiter, string $string [, int

Re: [PHP] explode string at new line

2007-06-06 Thread Paul Novitski
At 6/5/2007 10:50 PM, Jim Lucas wrote: Windows uses \r\n newlines; *nix uses \n; Mac uses \r. ... PHP Code: $txt = preg_replace('/\r\n|\r/', \n, $txt); Another way to write that PCRE pattern is /\r\n?/ (one carriage return followed by zero or one linefeed). I recall also running into

Re: [PHP] explode string at new line

2007-06-06 Thread Davi
Em Quarta 06 Junho 2007 02:50, Jim Lucas escreveu: Chris wrote: Davi wrote: Em Terça 05 Junho 2007 23:52, [EMAIL PROTECTED] escreveu: That's exactly correct. Except I /think/ you should use \n instead of '\n'. array explode ( string $delimiter, string $string [, int $limit] ) So,

Re: [PHP] explode string at new line

2007-06-06 Thread Davi
Em Quarta 06 Junho 2007 10:54, Davi escreveu: But... Why does it happen: [code] $object=mysql_fetch_object($result); $texto = $object-texto; $texto=preg_replace(/\r|\n/,,stripslashes($texto)); echo $texto; [/code] [output] Teste \r\nde formatação! \r\nTudo funcionando... \r\n

Re: [PHP] explode string at new line

2007-06-06 Thread Jim Lucas
Davi wrote: Em Quarta 06 Junho 2007 10:54, Davi escreveu: But... Why does it happen: [code] $object=mysql_fetch_object($result); $texto = $object-texto; $texto=preg_replace(/\r|\n/,,stripslashes($texto)); echo $texto; [/code] [output] Teste \r\nde formatação! \r\nTudo funcionando... \r\n

Re: [PHP] explode string at new line

2007-06-06 Thread Davi
Em Quarta 06 Junho 2007 13:20, Jim Lucas escreveu: Davi wrote: Em Quarta 06 Junho 2007 10:54, Davi escreveu: But... Why does it happen: [code] $object=mysql_fetch_object($result); $texto = $object-texto; $texto=preg_replace(/\r|\n/,,stripslashes($texto)); echo $texto;

[PHP] explode string at new line

2007-06-05 Thread Davi
Hi all. I've the fowlling string: $_POST[my_text]=hi...\nthis is my multi-line\ntext; Can I use explode to have something like: $str[0]=hi...; $str[1]=this is my multi-line; $str[2]=text; $str=explode($_POST[my_text],'\n'); TIA and sorry the *very* poor english. -- Davi Vidal [EMAIL

Re: [PHP] explode string at new line

2007-06-05 Thread heavyccasey
That's exactly correct. Except I /think/ you should use \n instead of '\n'. On 6/5/07, Davi [EMAIL PROTECTED] wrote: Hi all. I've the fowlling string: $_POST[my_text]=hi...\nthis is my multi-line\ntext; Can I use explode to have something like: $str[0]=hi...; $str[1]=this is my multi-line;

Re: [PHP] explode string at new line

2007-06-05 Thread Davi
Em Terça 05 Junho 2007 23:52, [EMAIL PROTECTED] escreveu: That's exactly correct. Except I /think/ you should use \n instead of '\n'. Thank you for the reply... =) I'll check this... BTW: array explode ( string $delimiter, string $string [, int $limit] ) So, I was wrong... The right way,

Re: [PHP] explode string at new line

2007-06-05 Thread Chris
Davi wrote: Em Terça 05 Junho 2007 23:52, [EMAIL PROTECTED] escreveu: That's exactly correct. Except I /think/ you should use \n instead of '\n'. Thank you for the reply... =) I'll check this... BTW: array explode ( string $delimiter, string $string [, int $limit] ) So, I was wrong... The

Re: [PHP] explode string at new line

2007-06-05 Thread Davi
Em Quarta 06 Junho 2007 00:18, Chris escreveu: Davi wrote: Em Terça 05 Junho 2007 23:52, [EMAIL PROTECTED] escreveu: That's exactly correct. Except I /think/ you should use \n instead of '\n'. So, I was wrong... The right way, probaly, is: $str=explode(\n,$_POST[my_text]); If

Re: [PHP] explode string at new line

2007-06-05 Thread Jim Lucas
Chris wrote: Davi wrote: Em Terça 05 Junho 2007 23:52, [EMAIL PROTECTED] escreveu: That's exactly correct. Except I /think/ you should use \n instead of '\n'. Thank you for the reply... =) I'll check this... BTW: array explode ( string $delimiter, string $string [, int $limit] ) So, I