解决方案 »

  1.   

    $str="<v:note id='33' count='0'>谢姣</v:note>
    <v:note id='34' count='0'>毕丹丹</v:note>
    <v:note id='35' count='0'>马朝莉</v:note>
    <v:note id='36' count='0'>李欣</v:note>
    <v:note id='37' count='1'>李萍</v:note>";
    preg_match_all("/<v:note id=\'\d+\' count=\'(\d)\'>(.*?)<\/v:note>/", $str, $matches);
    $newArr = array_combine($matches[2],$matches[1]);
    var_dump($newArr);
    ?>
    php数组中不可能存在相同键值的 所以只能用名字做键值保证唯一
      

  2.   

    不可能生成你要的这种。相同的key是不可以同时存在的。后者会覆盖前者。只能array('0'=>'谢姣','1'=>'毕丹丹','2'=>'马朝莉','3'=>'李欣','4'=>'李萍'); 类似这样。你的count不能做key的
      

  3.   

     结果多了个string  array(5) {
      ["谢姣"]=>
      string(1) "0"
      ["毕丹丹"]=>
      string(1) "0"
      ["马朝莉"]=>
      string(1) "0"
      ["李欣"]=>
      string(1) "0"
      ["李萍"]=>
      string(1) "1"
    }
     这个string 能去掉吗
      

  4.   

      我只要能头按照count 里面的值进行排序
      

  5.   


    没有string哪里的string 是你其他地方输出的吧