explode and escape character for string separator
| From: | Reuben D. Budiardja | Date: | Fri, 18 Jul 2003 18:47:18 +0000 |
| Subject: | explode and escape character for string separator | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-155814@lists.php.net to get a copy of this message | ||
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 = str_replace(":", "\:", $string1);
But that still won't work with explode. So, what can I use instead of explode?
Anything simple, and fast?
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.
Thanks for any help.
RDB
--
-------------------------------------------------
/"\ ASCII Ribbon Campaign against HTML
\ / email and proprietary format
X attachments.
/ \
-------------------------------------------------
Have you been used by Microsoft today?
Choose your life. Choose freedom.
Choose LINUX.
-------------------------------------------------