我想得到123,456两个数据,在js正则里加一个g修正符就行了  可在php里不认这个g 请问我该怎样得到同样效果 
<script>
MainString='aaa 123 bbb 456';
var re= /\d{3}/g; 
var m=MainString.match(re); 
//alert(m.length)
alert(m[0])
alert(m[1])
</script><?php
$str='aaa 123 bbb 456';
preg_match('/\d{3}/g',$str,$match);
echo $match[0]."<br>";
echo $match[1];?>