Re: [PHP-DB] numeric string to single digit array
[email protected] (Chris)
| Newsgroups | php.db |
|---|---|
| Message-ID | <[email protected]> |
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/