I have text with numbers.
I want to read text ,find numbers and get required numbers from string.
"my description has 123456789 numbers".
I want to get first four numbers from above message using php.
$string = 'my description has 123456789 numbers';
$number = preg_replace("/[^0-9]/", '', $string); // return 123456789
I mean I need 1234 from above string.