how to get number from a series of numbers in php

Ask about general coding issues or problems here.

Moderators: macek, egami, gesf

Post Reply
seandisanti
php-forum Fan User
php-forum Fan User
Posts: 973
Joined: Mon Oct 01, 2012 12:32 pm

Re: how to get number from a series of numbers in php

Post by seandisanti » Wed Apr 02, 2014 1:27 am

check out str_split() does exactly what you want:

Code: Select all

<?php 
$value = '123456789';
$split = str_split($value, 1);
echo '<pre>';
print_r($split);
prints:
Array
(
[0] => 1
[1] => 2
[2] => 3
[3] => 4
[4] => 5
[5] => 6
[6] => 7
[7] => 8
[8] => 9
)

Post Reply

Who is online

Users browsing this forum: Baidu [Spider] and 1 guest