Re: Need help with a string
| From: | Greg Donald | Date: | Fri, 08 Oct 2004 17:06:19 +0000 |
| Subject: | Re: Need help with a string | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-198996@lists.php.net to get a copy of this message | ||
On Fri, 8 Oct 2004 11:38:23 -0500, Brent Clements
<bclem@imaginative-enterprises.com> wrote:
> Given the following string:
>
> $textString = "Share A Dream Come True Parade 3:00 SpectroMagic Parade 9:00, 11:00 Wishes?
> nighttime spectacular 10:00"
>
> I need to break the string up into pieces where as
>
> $string[1] = "Share A Dream Come True Parade 3:00"
> $string[2] = "SpectroMagic Parade 9:00, 11:00"
> $string[3] = "Wishes? nighttime spectacular 10:00"
>
> Granted this is pretty easy because I could just search for this stuff and break it up, but the
> string above can actually be different each time, for instance, next time it could be:
>
> $textString = "Share A Dream Come True Parade 3:00, 5:00 SpectroMagic Parade 9:00, 11:00
> Wishes? nighttime spectacular 10:00"
>
> I think my main issue is that I don't know how to keep the , XX:XX part combined with the
> previous part of the string.
preg_match_all() is what you want to use. You can easily match
everything up to the time since it's formed with a ":00" at the end
each time.
--
Greg Donald
Zend Certified Engineer
http://gdconsultants.com/
http://destiney.com/