我如何从php文本提取所有4位数字


How can I extract all 4-digit numbers from a php text?

例如:我有一个文本testt1591fff44f43f0015ffef159,在该字符串中不会有超过4个连续的数字,我如何通过PHP从中提取1591和0015 ?

http://www.php.net/manual/en/function.preg-match-all.php

<?php
$text = 'testt1591fff44f43f0015ffef159';
preg_match_all('~'d{4}~',  $text, $matches);
?>

未测试代码