我的代码中有些东西使str_replace不起作用

时间:2017-01-23 23:20:45

标签: php html

我的PHP代码中有许多for循环。在最后一个中,您可以看到我尝试使用str_replace进行回显。当我尝试更换像A' A'它工作正常。但是,当我尝试使用像AB' AB'它不会取代任何东西。 这就是所有的代码。

$data = array();
$files = scandir('files/');
foreach($files as $file) {
    $count = 0;
    if ($filea = fopen('files/'.$file, "r")) {
        while(!feof($filea)) {
            $line = fgets($filea);
            if ($count > 1 and strlen($line)>1){
                $data[] = explode(";", $line);
            }
            $count++;
        }
        fclose($filea);
    }
}

$orgnized = array();

foreach($data as $doc){
    $bis = str_replace("AB","",$doc[1]);
    echo($bis)."</br>";
    if(!isset($orgnized[$doc[1]])){
        $orgnized[$doc[1]] = array();
    }
    $orgnized[$doc[1]][] = $doc;
}

output

Input File

0 个答案:

没有答案