偶昏倒
preg_match_all("/(-| |\:)([0-9])(-| |\:)/",$t[$j],$mm);
for($i=0;$i<count($mm[2])-1;$i++)
$mm[2]="0".$mm[2];是替换了
可是我怎么连接起来得到一个字符串呢?

解决方案 »

  1.   

    看看<?php
    preg_match_all("|<[^>]+>(.*)</[^>]+>|U", "<div align=left>a test</div>", $out, PREG_SET_ORDER);
    print $out[0][0].", ".$out[0][1]."\n";
    print $out[1][0].", ".$out[1][1]."\n"
    ?>传回值为           <b>example: </b>, example: 
    <div align=left>this is a test</div>, this is a test 
      

  2.   

    有点毛病
    $s = "2003-3-9 12:1:2";
    echo preg_replace("/([- :])([0-9])([^0-9]?)/U","\\1 0\\2\\3",$s);
      

  3.   

    呵呵,终于看到这个贴了。
    preg_replace("/([-: ])(\d)(?=\D|$)/e","'\\1'.'0'.'\\2'",$s)