By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,640 Members | 1,672 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,640 IT Pros & Developers. It's quick & easy.

Whitespacing in processing strings.

P: n/a
Hi all,

I am a relative newbie to the PHP language but at present I am trying
to write some code that would process text (in a string, not an
array)by the explode() method. Basically, I want to seperate different
words out by using the explode(" ", $text); command, yet I find that
this approach tends to die when I perform this on strings taken from
texts with carriage returns in.

Any suggestions to tackling this problem would be greatly appreciated!
William Cheung
Jul 17 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
William Cheung wrote:
Hi all,

I am a relative newbie to the PHP language but at present I am trying
to write some code that would process text (in a string, not an
array)by the explode() method. Basically, I want to seperate different
words out by using the explode(" ", $text); command, yet I find that
this approach tends to die when I perform this on strings taken from
texts with carriage returns in.
Hi William,

dies?
I don't believe that.
I think you made a mistake in your code instead causing it to loop forever.
Please post the relevant PHP-code so we can check.

Any suggestions to tackling this problem would be greatly appreciated!
William Cheung


Regards,
Erwin Moller

Jul 17 '05 #2

P: n/a
Hi William,
Haven't tested this, but it occurs to me that you may be able to remove
the carriage returns with strstr. If that fails, try preg_split:
http://us4.php.net/preg_split

Good luck,

Eric

"William Cheung" <ga******@hotmail.com> wrote in message
news:32**************************@posting.google.c om...
Hi all,

I am a relative newbie to the PHP language but at present I am trying
to write some code that would process text (in a string, not an
array)by the explode() method. Basically, I want to seperate different
words out by using the explode(" ", $text); command, yet I find that
this approach tends to die when I perform this on strings taken from
texts with carriage returns in.

Any suggestions to tackling this problem would be greatly appreciated!
William Cheung

Jul 17 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.