Re: numeric string to single digit array

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



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/

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux