另外,还有,
结果中的$aaa%s 中的%s可以省略 其它的不能省略

解决方案 »

  1.   

    $bb = split('%', $b);
    for($i=0; $i<min(count($a),count($bb)); $i++) {
      $bb[i] .= $a[i];
    }
    $o = join('%', $bb);
      

  2.   

    $a   =  array(111,222,333);$b   =   'test   %s   and   test   %o   and   %s '; $b = explode( '%', $b ); foreach( $b as $key => $var )
    {
    if( !empty( $a[$key] ) )
    {
        $b[$key] = $var.$a[$key];
    }
    }$b = implode( "%", $b );echo  $b;测试过了,可以...
      

  3.   


    $a   =   array(1,2,3);
    $b   =   'test   %s   and   test   %o   and   %s ';echo str_replace('&&&&','%',vsprintf( str_replace('%','%s&&&&',$b), $a));
      

  4.   

    str_replace,preg_replace都可以吧,就一个函数,你看下手册就知道了