Re: [PHP] take text before '-' and after it

2002-12-12 Thread ed
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 -

Re: [PHP] take text before '-' and after it

2002-12-12 Thread Michael Montero
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 [EMAIL PROTECTED] wrote: Wouldn't it be simpler to just remove the '-'? $var = str_replace(-,,$var); Ed On

Re: [PHP] take text before '-' and after it

2002-12-12 Thread 1LT John W. Holmes
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. $array = explode(-,$song); ---John Holmes...

Re: [PHP] take text before '-' and after it

2002-12-12 Thread Antti
[EMAIL PROTECTED] 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

Re: [PHP] take text before '-' and after it

2002-12-12 Thread Richard Baskett
$song = They Might Be Giants - No!.mp3 $arr = explode(' - ', $song); $length = strlen($arr[1]); // gets char length of song $artist = $arr[0]; $song = substr($arr[1], 0, ($length-4); // deletes the .mp3 off of song name Cheers! Rick He who is devoid of the power to forgive is devoid of the

Re: [PHP] take text before '-' and after it

2002-12-12 Thread Antti
$array = explode(-,$song); ---John Holmes... Ok, I got this. But still I don't know how to read the files from a directory and put them into an array so I can explode them. antti -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php

Re: [PHP] take text before '-' and after it

2002-12-12 Thread 1LT John W. Holmes
$array = explode(-,$song); ---John Holmes... Ok, I got this. But still I don't know how to read the files from a directory and put them into an array so I can explode them. examples here: http://www.php.net/manual/en/ref.dir.php ---John Holmes... -- PHP General Mailing List

Re: [PHP] take text before '-' and after it

2002-12-12 Thread Justin French
Hi, ? $file = Some Artist - Some Song.mp3; list($artist,$song) = explode('-',$file); $artist = trim($artist); $song = trim(str_replace('.mp3','',$song)); ? Then you can do whatever you want with them... but I can't see why you'd write them to a disk file AND write them to a mysql database --