<?php $str="I have 12 dogs and 20 cats"; preg_match_all('!\d+!', $str, $matches); print_r($matches); ?>This code will give output in an array format like given below. Array ( [0] => Array ( [0] => 12 [1] => 20 ) )
(Visited 81 times, 1 visits today)
<?php $str="I have 12 dogs and 20 cats"; preg_match_all('!\d+!', $str, $matches); print_r($matches); ?>This code will give output in an array format like given below. Array ( [0] => Array ( [0] => 12 [1] => 20 ) )