Re: numeric string to single digit array
| From: | Chris | Date: | Wed, 26 Mar 2008 00:09:57 +0000 |
| Subject: | Re: numeric string to single digit array | ||
| References: | 1 | Groups: | php.db |
| Request: | Send a blank email to php-db+get-44791@lists.php.net to get a copy of this message | ||
Richard Dunne wrote:
Can anyone tell me how how to convert a string of integers into an array of single digit integers. i.e. "1223123" into ['1','2,','2','3','1,'2','3'] ?$string = '12345'; $array = array(); for ($i = 0; $i < strlen($string); $i++) { $array[] = $string[$i]; } I'm sure there's probably a better way but this is simple and easy to read.
When I retreive a column of single digit integers I end up with a long string of numbers.From a database or something? What does your code look like? -- Postgresql & php tutorials http://www.designmagick.com/