note 31036 deleted from function.preg-split by sniper

From: Date: Tue, 30 Sep 2003 12:35:00 +0000
Subject: note 31036 deleted from function.preg-split by sniper
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-57492@lists.php.net to get a copy of this message
Note Submitter: discordantus.mapSoN@mac.com ---- I needed to split a string into an array of characters, and couldn't find a built in function to do it. This: $array = explode("", $string) didn't work. So I used this: $array = preg_split('/(?<=.)(?=.)/', $string); this uses perl-style regular expressions to split at any point where there is a character behind and in front of that point. hope this helps someone!

« previous php.notes (#57492) next »