Contact: aviboots(AT)netvision.net.il
39,988 questions
51,933 answers
573 users
$s = "Today i like the number 31 and the number 13 tomorrow... maybe 100 :-)"; preg_match_all('!\d+!', $s, $numbers); print_r($numbers); /* run: Array ( [0] => Array ( [0] => 31 [1] => 13 [2] => 100 ) ) */
$s = '12php 36java20'; preg_match_all('!\d+!', $s, $num_matches); print_r($num_matches[0]); /* run: Array ( [0] => 12 [1] => 36 [2] => 20 ) */
$s = '12php 36java20 90 01'; preg_match_all('!\d+!', $s, $num_matches); foreach ($num_matches[0] as $val) { echo $val . "\n"; } /* run: 12 36 20 90 01 */