let have following formatting number string in php:
12,345,678.97
how break in php array following?
array ( [0] => 12, [1] => ',', [2] => '345', [3] => ',', [4] => '678', [5] => '.', [6] => '97' );
or
array ( [0] => 97, [1] => '.', [2] => '678', [3] => ',', [4] => '345', [5] => ',', [6] => '12' );
i want break string numbers broken groups , characters between groups of numbers broken out too. need in order automatically determine thousands/decimal separator in php currency strings.
using preg_split
work in case:
// split @ non-number $arr = preg_split('/(\d)/', $str, -1, preg_split_delim_capture);
Comments
Post a Comment