我有两个数组。它们似乎至少包含一组相同的值,但是 array_diff()
即使我认为应该执行,也不会返回任何东西!这应该只是例行代码,但由于某种原因,它不喜欢我所做的。
奇怪的是,var_dump($queue[0]);
返回String(167);
和var_dump($videos[0])
返回String(168)
。
很明显,它们一定是不同的吧?
echo similar_text($queue[0]), $videos[0]);
返回167
。什么!?
注意:这些只是文件名,并不代表文件的内容。
视频阵列
Array ( [0] => /var/www/downloads/j2/Dexter Season 1, 2, 3, 4, 5 & 6 + Extras (Early Cuts, Audiobooks etc) DVDRip HDTV TSV/Season 3/Dexter Season 3 Episode 04 - All in the Family.avi )
队列数组
Array ( [0] => /var/www/downloads/j2/Dexter Season 1, 2, 3, 4, 5 & 6 + Extras (Early Cuts, Audiobooks etc) DVDRip HDTV TSV/Season 3/Dexter Season 3 Episode 04 - All in the Family.avi [1] => j2 )
输出
$diff = array_intersect($queue,$videos); print_r($diff);
返回 Array ( )
var_dump($queue[0]);
返回string(167) "/var/www/downloads/j2/Dexter Season 1, 2, 3, 4, 5 & 6 + Extras (Early Cuts, Audiobooks etc) DVDRip HDTV TSV/Season 3/Dexter Season 3 Episode 04 - All in the Family.avi"
var_dump($videos[0]);
返回 string(168) "/var/www/downloads/j2/Dexter Season 1, 2, 3, 4, 5 & 6 + Extras (Early Cuts, Audiobooks etc) DVDRip HDTV TSV/Season 3/Dexter Season 3 Episode 04 - All in the Family.avi"
echo similar_text($queue[0], $videos[0]);
返回 167
。
我已经将字符串放入 JavaScript 字符计数中,我使用 strlen()、trim() 来修剪空白,我什至手动单独计算了每个字符。这是怎么回事?