note 5457 deleted from split by ronabop

From: Date: Fri, 11 Aug 2000 16:05:50 +0000
Subject: note 5457 deleted from split by ronabop
Groups: php.notes 
Request: Send a blank email to php-notes+get-1234@lists.php.net to get a copy of this message
Is it possible to reference the item I did the split on as part of the returned array as well? I want to be able to say:<br> <pre> $text = "abcdefghijkl"; $parts = split("(de|hi|k)", $text); </pre> but then, I want the array that comes back to contain the following: <pre> $parts[0] = "abc"; $parts[1] = "de"; $parts[2] = "fg"; $parts[3] = "hi"; $parts[4] = "j"; $parts[5] = "k"; $parts[6] = "l"; </pre> See? Perl lets me do this, but ...i don't see it happening in PHP...just now. Any help? I'd hate to have to ereg match things one at a time...

« previous php.notes (#1234) next »