回答編集履歴

1

加筆修正

2020/08/14 00:04

投稿

退会済みユーザー
test CHANGED
@@ -13,3 +13,71 @@
13
13
  WIN32APIを使って実装されているために、
14
14
 
15
15
  ファイルシステム上でUnicodeを許容している場合に問題が生じやすいってことのようです。
16
+
17
+
18
+
19
+ じゃぁarray_unique()を駆使したらどうかっていうと、
20
+
21
+ これで抑え込むことができました。
22
+
23
+
24
+
25
+ ```php
26
+
27
+ <?php
28
+
29
+
30
+
31
+ $dir="test/";
32
+
33
+ //for ($i=1;$i<=100000;$i++){
34
+
35
+ // file_put_contents($dir.$i.".txt",$i);
36
+
37
+ //}
38
+
39
+ $files=glob($dir."*");
40
+
41
+ echo count($files);
42
+
43
+ echo PHP_EOL;
44
+
45
+ //var_export($files);
46
+
47
+ //echo PHP_EOL;
48
+
49
+
50
+
51
+ $unique_files = array_unique(array_values($files), SORT_STRING);
52
+
53
+ echo count($unique_files);
54
+
55
+ echo PHP_EOL;
56
+
57
+ ```
58
+
59
+
60
+
61
+ ちなみに、php.iniの設定値も添えておきます。
62
+
63
+ mbstring.language = Japanese
64
+
65
+ mbstring.internal_encoding = UTF-8
66
+
67
+ ;mbstring.http_input =
68
+
69
+ ;mbstring.http_output =
70
+
71
+ ;mbstring.encoding_translation = Off
72
+
73
+ ;mbstring.detect_order = auto
74
+
75
+ ;mbstring.substitute_character = none
76
+
77
+ ;mbstring.func_overload = 0
78
+
79
+ ;mbstring.strict_detection = On
80
+
81
+ ;mbstring.http_output_conv_mimetype=
82
+
83
+ ;mbstring.regex_stack_limit=100000