Re: converting string into array with regex
| From: | Burhan Khalid | Date: | Fri, 05 Dec 2003 11:22:51 +0000 |
| Subject: | Re: converting string into array with regex | ||
| References: | 1 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-171967@lists.php.net to get a copy of this message | ||
Adam i Agnieszka Gasiorowski FNORD wrote:
How would you specify a regex to convert string into array using preg_split? Is there some symbol specyfying a place between letters ? s t r i n g => array('s', 't', 'r', 'i', 'n', 'g')You can access a string's characters with an index without declaring it as an array. $string = "foo"; echo $string{0}; //outputs f http://www.php.net/substr (has an example) Maybe this will solve your problem without using preg_split? -- Burhan Khalid phplist[at]meidomus[dot]com http://www.meidomus.com ----------------------- "Documentation is like sex: when it is good, it is very, very good; and when it is bad, it is better than nothing."^ ^ ^ ^ ^