Re: take text before '-' and after it
| From: | Michael Montero | Date: | Thu, 12 Dec 2002 15:56:16 +0000 |
| Subject: | Re: take text before '-' and after it | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-128022@lists.php.net to get a copy of this message | ||
You can use split() or explode().
$string = "1234-5467" ;
list( $before_dash, $after_dash ) = explode( "-", $string ) ;
or
$array = explode( "-", $string ) ;
On Thu, 12 Dec 2002 ed@home.homes2see.com wrote:
>
> Wouldn't it be simpler to just remove the '-'?
>
> $var = str_replace("-","",$var);
>
> Ed
>
>
> On Thu, 12 Dec 2002, Antti wrote:
>
> > How can I take some text before the mark - and after it and put them for
> > example in array. The purpose of this is to read trough mp3 files which
> > are in the form of artist - song.mp3 and put them into a text file so I
> > can put them into mysql db.
> >
> > antti
> >
> >
> > --
> > PHP General Mailing List (http://www.php.net/)
> > To unsubscribe, visit: http://www.php.net/unsub.php
> >
>
>
>
--
Michael C. Montero
Chief Technology Officer
Community Connect Inc. Co-founder
MMontero@Mail.CommunityConnect.com
-=-=-=-=-= Community Connect Inc. -=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-
The Premier Source of Interactive Online Communities 149 Fifth Avenue
http://www.CommunityConnectInc.com/
New York, NY 10010
http://www.AsianAvenue.com/ http://www.BlackPlanet.com/
Click into Asian America The World Is Yours
http://www.MiGente.com/ http://www.DiversityJobMarket.com/
The Power of Latinos In partnership with The New
York Times
----- Your Message May Appear Below This Line