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... Th

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",$_P

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 w

Re: [PHP] explode string at new line

2007-06-05 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-05 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 \n

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 [, i

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 f

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...

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/","",stripslash

[PHP] [ERR] RE: [PHP] explode separate lines

2004-02-04 Thread postmaster
Transmit Report: To: [EMAIL PROTECTED], 402 Local User Inbox Full ([EMAIL PROTECTED]) --- Begin Message --- Diana Castillo wrote: > does anyone know how to do an explode where the separator is a > linefeed? > You could try explode("\n", $stuff);, but if you are wanting to read information from

Re: [PHP] Explode a variable into each character

2001-02-23 Thread Rasmus Lerdorf
> I have a string of 1034 and I want to have an array that has each number in > an element.(ex: num[0] = 1, num[1] = 0, num[2] = 3 num[3] = 4) Is there a > way to explode a string by each character? Just convert it to a string: ie. $foo = (string)$num; echo $foo[1]; -Rasmus -- PHP General M

Re: [PHP] Explode a variable into each character

2001-02-23 Thread Philip Olson
If $string is a string, like : $string = '312'; Then one can do : $string[0]; // 3 $string[1]; // 1 $string[2]; // 2 Note, '312' is a string and will work using above but if we define 312 as an integer like : $string = 312; Then $string[0] will not "work" and it'll need to

[PHP] explode and escape character for string separator

2003-07-18 Thread Reuben D. Budiardja
Hi all, Suppose I have a long string like $myStr = "$string1:$string2:$string3"; I can obviously explode them using ":" as the separator. But what if $string1 contains the character ":" by itself? I was thinking, first I am gonna put an escaping character, so I can do something like: $string1

Re: [PHP] explode and escape character for string separator

2003-07-18 Thread Chris Shiflett
--- "Reuben D. Budiardja" <[EMAIL PROTECTED]> wrote: > Suppose I have a long string like > $myStr = "$string1:$string2:$string3"; > > I can obviously explode them using ":" as the separator. But what if > $string1 contains the character ":" by itself? You should strive to make your delimiter uni

Re: [PHP] explode and escape character for string separator

2003-07-18 Thread Reuben D. Budiardja
On Friday 18 July 2003 02:42 pm, Chris Shiflett wrote: > --- "Reuben D. Budiardja" <[EMAIL PROTECTED]> wrote: > > Suppose I have a long string like > > $myStr = "$string1:$string2:$string3"; > > > > I can obviously explode them using ":" as the separator. But what if > > $string1 contains the chara

Re: [PHP] explode and escape character for string separator

2003-07-18 Thread CPT John W. Holmes
> On Friday 18 July 2003 02:42 pm, Chris Shiflett wrote: > > --- "Reuben D. Budiardja" <[EMAIL PROTECTED]> wrote: > > > Suppose I have a long string like > > > $myStr = "$string1:$string2:$string3"; > > > > > > I can obviously explode them using ":" as the separator. But what if > > > $string1 cont

Re: [PHP] explode and escape character for string separator

2003-07-18 Thread Brad Pauly
Reuben D. Budiardja wrote: I did strive for that. But whatever character I choose, the problem remains that we can't guarantee that it's going ot be only used as deliminater, since the deliminated string is an input from user. So the problem remains. Are you adding the delimiter? If so, maybe yo

Re: [PHP] explode and escape character for string separator

2003-07-18 Thread Brent Baisley
One set of delimiters I often use for text files is ~~ or ^^. They are fairly unique. If they do appear in a file then there is probably garbage in the file and I want to know about. For my templates "delimiter" I use {::TagName::}. You could use }::{ as your delimiter. Don't limit yourself to

Re: [PHP] explode and escape character for string separator

2003-07-18 Thread Reuben D. Budiardja
On Friday 18 July 2003 03:01 pm, you wrote: > > On Friday 18 July 2003 02:42 pm, Chris Shiflett wrote: > > > --- "Reuben D. Budiardja" <[EMAIL PROTECTED]> wrote: > > > > Suppose I have a long string like > > > > $myStr = "$string1:$string2:$string3"; > > > > > > > > I can obviously explode them usi

Re: [PHP] explode and escape character for string separator

2003-07-18 Thread Jason Wong
On Saturday 19 July 2003 03:04, Reuben D. Budiardja wrote: > > You should strive to make your delimiter unique. A delimiter that might > > possibly appear within the items it is meant to delimit is no longer a > > delimiter. > > I did strive for that. But whatever character I choose, the problem r

Re: [PHP] explode and escape character for string separator

2003-07-18 Thread Tyler
load a bunch of characters into an array. Do a loop through that array and check all of your $strings for the current character in your loop. If the current array character does not exist in any of them, you have your delimiter. I could put together an example if you want me to. __

Re: [PHP] explode and escape character for string separator

2003-07-18 Thread Chris Sherwood
en rebuild the string and delimit it yourself Chris - Original Message - From: "Reuben D. Budiardja" <[EMAIL PROTECTED]> To: <[EMAIL PROTECTED]> Sent: Friday, July 18, 2003 11:47 AM Subject: [PHP] explode and escape character for string separator Hi all, Suppose

Re: [PHP] explode and escape character for string separator

2003-07-18 Thread CPT John W. Holmes
From: "Reuben D. Budiardja" <[EMAIL PROTECTED]> > > This is a hypothetical situation. The real situation is that I am trying to > have a protocol for data sent by client using Flash. But the basic question > remains. So FLASH is creating the string that you must decode in PHP? Is there any way to

Re: [PHP] explode and escape character for string separator

2003-07-18 Thread Reuben D. Budiardja
do I know which "_" is my doing? Because in my case, it's faily conceivable that "_" will get used. RDB > Chris > - Original Message - > From: "Reuben D. Budiardja" <[EMAIL PROTECTED]> > To: <[EMAIL PROTECTED]> > Sent

Re: [PHP] explode and escape character for string separator

2003-07-18 Thread Chris Shiflett
--- Reuben D. Budiardja wrote: > I did strive for that. But whatever character I choose, the problem > remains that we can't guarantee that it's going ot be only used as > deliminater, since the deliminated string is an input from user. So > the problem remains. Well, just to point out, your delim

Re: [PHP] explode and escape character for string separator

2003-07-18 Thread Reuben D. Budiardja
On Friday 18 July 2003 03:43 pm, CPT John W. Holmes wrote: > From: "Reuben D. Budiardja" <[EMAIL PROTECTED]> > > > This is a hypothetical situation. The real situation is that I am trying > > to > > > have a protocol for data sent by client using Flash. But the basic > > question > > > remains. > >

Re: [PHP] explode and escape character for string separator

2003-07-18 Thread Grant Rutherford
Chris Shiflett wrote: --- Reuben D. Budiardja wrote: I did strive for that. But whatever character I choose, the problem remains that we can't guarantee that it's going ot be only used as deliminater, since the deliminated string is an input from user. So the problem remains. Well, just to

Re: [PHP] explode and escape character for string separator

2003-07-18 Thread Cesar Cordovez
Among other things, this is why XML exists. Use XML. FLASH can handle it, PHP can handle it, everything out there can handle it. Use XML. Delimiters will sooner or later break down. Use XML. Over and out. Grant Rutherford wrote: Chris Shiflett wrote: --- Reuben D. Budiardja wrote: I d

Re: [PHP] explode and escape character for string separator

2003-07-18 Thread Curt Zirzow
Reuben D. Budiardja <[EMAIL PROTECTED]> wrote: > Anything simple, and fast? xml is simple, and fast to implement. -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

[PHP] explode() an array and grep out a string

2004-02-07 Thread Bobby R . Cox
Hi all. Is it possible to explode an array and have it exclude a certain string. I currently have an array that is an ldapsearch that returns sub-accounts of a parent account. These accounts are then displayed so customer can either change the passwd or delete them.Thing is ldapsearch re

[PHP] explode? (table field to a variable of same name)

2002-02-19 Thread Baloo :0\)
How can I assign automatically all fields of a database to a variable of the same name? Instead of having to manually do $user_id=$row["user_id"]; etc Then how could I know the number of fields in the table so I can do a loop to print them all in html? In advance, thanks for your help. Alfredo

Re: [PHP] explode() an array and grep out a string

2004-02-07 Thread Adam Bregenzer
On Sat, 2004-02-07 at 03:09, Bobby R.Cox wrote: > Is it possible to explode an array and have it exclude a certain > string. I currently have an array that is an ldapsearch that returns > sub-accounts of a parent account. These accounts are then displayed so > customer can either change the pa

RE: [PHP] explode? (table field to a variable of same name)

2002-02-19 Thread Rick Emery
: Baloo :0) [mailto:[EMAIL PROTECTED]] Sent: Tuesday, February 19, 2002 3:41 PM To: [EMAIL PROTECTED] Subject: [PHP] explode? (table field to a variable of same name) How can I assign automatically all fields of a database to a variable of the same name? Instead of having to manually do $user_id=$ro

Re: [PHP] explode? (table field to a variable of same name)

2002-02-19 Thread Simon Willison
First grab an associative array of the variables from the database with mysql_fetch_array() Then use extract($array); to extract all of the variables in the array to the symbol table: www.php.net/extract Simon Baloo :0) wrote: >How can I assign automatically all fields of a database to a va

Re: [PHP] explode? (table field to a variable of same name)

2002-02-19 Thread Christopher William Wesley
This may not be what you want to do, but should give you some hints. (This is my code which I use to simply dump any SQL table into an HTML table I can view in a browser ... for small tables, of course.) Using MySQL as an example: // assuming you ran a query and stored results in $mysql_result_s

Re: [PHP] explode? (table field to a variable of same name)

2002-02-19 Thread Rasmus Lerdorf
This creates all the variables you asked for and also prints each one in a column of a table. foreach($row as $key=>$val) { $$key = $val; echo "$val"; } -Rasmus On Tue, 19 Feb 2002, Baloo :0) wrote: > How can I assign automatically all fields of a database to a variable of > the same n

Re: [PHP] explode? (table field to a variable of same name)

2002-02-19 Thread Christopher William Wesley
oi ... typo! see below. sorry :( ~Chris On Tue, 19 Feb 2002, Christopher William Wesley wrote: > This may not be what you want to do, but should give you some hints. > (This is my code which I use to simply dump any SQL table into an HTML > table I can view in a browser ... for small

<    1   2