[請益] 比較字串困擾
弄了幾天 還是無解 崩潰了= =
字串比來比去就是有問題...
stopword3.txt
內容如下:
q
w
d
0
10
23
0
0
---
下面是程式碼:
<?
//read stoplist
$fp = fopen('stopword3.txt','r');
//$f2p = fopen('stopword2.txt','w');
$stop_count = 0;
while(!feof($fp)){
$stop_count++;
$stoplist[$stop_count] = fgets($fp);
$stoplist[$stop_count] = str_replace("\n","",$stoplist[$stop_count]);
}
fclose($fp);
$ttt = "0";
for($i=1;$i<=$stop_count;$i++){
echo "stopword is :".$stoplist[$i]."<br>";
if(strnatcasecmp($stoplist[$i], $ttt) == 0){
echo "got it ! <br>";
flush();
}
}
?>
----------------------
if(strnatcasecmp($stoplist[$i], $ttt) == 0)
這樣寫應該沒錯吧= =
他一直找不到...好煩惱QQ
--
※ 發信站: 批踢踢實業坊(ptt.cc)
◆ From: 114.42.21.156
→
01/13 13:14, , 1F
01/13 13:14, 1F
→
01/13 13:20, , 2F
01/13 13:20, 2F
推
01/13 13:37, , 3F
01/13 13:37, 3F
→
01/13 13:40, , 4F
01/13 13:40, 4F
→
01/14 00:35, , 5F
01/14 00:35, 5F
PHP 近期熱門文章
PTT數位生活區 即時熱門文章
6
14