質問編集履歴

2

2021/01/22 01:17

投稿

tundorian-hamu
tundorian-hamu

スコア42

test CHANGED
File without changes
test CHANGED
@@ -25,105 +25,3 @@
25
25
 
26
26
 
27
27
  悪いコードなどがございましたらご教示お願いいたします。
28
-
29
- ```php
30
-
31
- <?php
32
-
33
- $target = $argv[1];
34
-
35
- $days = [];
36
-
37
- $days = [
38
-
39
- isset($argv[2]) ? $argv[2] : null,
40
-
41
- isset($argv[3]) ? $argv[3] : null
42
-
43
- ];
44
-
45
- function test($target, $days)
46
-
47
- {
48
-
49
- $data = [];
50
-
51
- $value = [];
52
-
53
- foreach ($days as $day) {
54
-
55
- $file = "{$day}.txt";
56
-
57
- if ($day === null) {
58
-
59
- continue;
60
-
61
- } elseif (!file_exists($file)) {
62
-
63
- echo "{$file}というファイルは存在しません。";
64
-
65
- continue;
66
-
67
- } else {
68
-
69
- $fpr = fopen($file, "r");
70
-
71
- $fpw = fopen("{$file}_count.txt", "w");
72
-
73
- while ($line = fgets($fpr)) {
74
-
75
- $pattern = "/^((?!{$target}).)*$\n/m";
76
-
77
- var_dump($target);
78
-
79
- $Replace = preg_replace($pattern, '', $line);
80
-
81
- $pattern2 = "/URL: (.+)?/m";
82
-
83
- preg_match($pattern2, $Replace, $matches);
84
-
85
- if (empty($matches[1])) {
86
-
87
- continue;
88
-
89
- } else {
90
-
91
- $data[] = $matches[1];
92
-
93
- }
94
-
95
- }
96
-
97
- echo count($data) . "件のデータを抽出しました。";
98
-
99
- }
100
-
101
- }
102
-
103
-
104
-
105
- $data = array_count_values($data);
106
-
107
- arsort($data);
108
-
109
- if (isset($fpr)) {
110
-
111
- foreach ($data as $key => $value) {
112
-
113
- fwrite($fpw, "{$value}件 {$key}\r\n");
114
-
115
- }
116
-
117
-
118
-
119
- fclose($fpr);
120
-
121
- fclose($fpw);
122
-
123
- }
124
-
125
- }
126
-
127
- test($target, $days);
128
-
129
- ```

1

タイトルの修正

2021/01/22 01:17

投稿

tundorian-hamu
tundorian-hamu

スコア42

test CHANGED
@@ -1 +1 @@
1
- phpでセグメンテーション コアダンプのエラーが出る
1
+ linuxでセグメンテーション コアダンプのエラーが出る
test CHANGED
File without changes