RE: [PHP] Splitting string

From: Date: Sun, 10 Dec 2006 10:57:39 +0000
Subject: RE: [PHP] Splitting string
References: 1 2  Groups: php.general 
Request: Send a blank email to php-general+get-245687@lists.php.net to get a copy of this message
Hi, > I think the easiest way, if you can guarantee exactly 50 spaces as > the > separator, is to simply explode() it. > > $string = "EVOLUTION DEAR > GOD > BOYZ_II_MEN "; > > $arr = explode(str_repeat(' ', 50), $string); > > You could also use a regex, but that's probably overkill if your > separator is > that simple. If it's not, then you may need a regex. > Tried this ... and it returns $arr[0] as EVOLUTION DEAR GOD BOYZ_II_MEN ... which in fact is wrong ... I would like ...; $arr[0] => EVOLUTION "word + spaces = 50 chars" $arr[1] => DEAR GOD "words + spaces = 50 chars" Etc ... Steven

« previous php.general (#245687) next »