回答編集履歴
1
加筆修正
answer
CHANGED
@@ -5,4 +5,38 @@
|
|
5
5
|
|
6
6
|
詳しくはわかりませんが、
|
7
7
|
WIN32APIを使って実装されているために、
|
8
|
-
ファイルシステム上でUnicodeを許容している場合に問題が生じやすいってことのようです。
|
8
|
+
ファイルシステム上でUnicodeを許容している場合に問題が生じやすいってことのようです。
|
9
|
+
|
10
|
+
じゃぁarray_unique()を駆使したらどうかっていうと、
|
11
|
+
これで抑え込むことができました。
|
12
|
+
|
13
|
+
```php
|
14
|
+
<?php
|
15
|
+
|
16
|
+
$dir="test/";
|
17
|
+
//for ($i=1;$i<=100000;$i++){
|
18
|
+
// file_put_contents($dir.$i.".txt",$i);
|
19
|
+
//}
|
20
|
+
$files=glob($dir."*");
|
21
|
+
echo count($files);
|
22
|
+
echo PHP_EOL;
|
23
|
+
//var_export($files);
|
24
|
+
//echo PHP_EOL;
|
25
|
+
|
26
|
+
$unique_files = array_unique(array_values($files), SORT_STRING);
|
27
|
+
echo count($unique_files);
|
28
|
+
echo PHP_EOL;
|
29
|
+
```
|
30
|
+
|
31
|
+
ちなみに、php.iniの設定値も添えておきます。
|
32
|
+
mbstring.language = Japanese
|
33
|
+
mbstring.internal_encoding = UTF-8
|
34
|
+
;mbstring.http_input =
|
35
|
+
;mbstring.http_output =
|
36
|
+
;mbstring.encoding_translation = Off
|
37
|
+
;mbstring.detect_order = auto
|
38
|
+
;mbstring.substitute_character = none
|
39
|
+
;mbstring.func_overload = 0
|
40
|
+
;mbstring.strict_detection = On
|
41
|
+
;mbstring.http_output_conv_mimetype=
|
42
|
+
;mbstring.regex_stack_limit=100000
|