I want to separate 123456 and ... and still get the number and the period in php.
I tried using preg_replace():
Code: Select all
$numbers = preg_replace('/[^0-9]/', '', '123456...');
$period = preg_replace('/./', '', '123456...);
Code: Select all
$numbers = preg_replace('/[^0-9]/', '', '123456...');
$period = preg_replace('/./', '', '123456...);
Code: Select all
$matches = null;
$input = '123456...';
preg_match('/(?<nums>\d+)(?<periods>\.+)/', $input, $matches);
$numbers = $matches['nums'];
$periods = $matches['periods'];
$nums_only = preg_replace('/[^\d]/', '', $input);