回答編集履歴
1
方針転換
test
CHANGED
@@ -1 +1,19 @@
|
|
1
|
+
```php
|
2
|
+
|
3
|
+
$levels = [1, 2, 3, 4, 5, 101, 102, 103, 104, 105, ...];
|
4
|
+
|
5
|
+
$found = -1;
|
6
|
+
|
7
|
+
for ($i = 0; $i < count($levels); $i++)
|
8
|
+
|
1
|
-
|
9
|
+
if ($levels[$i] == $levelID) {
|
10
|
+
|
11
|
+
$found = $i; break;
|
12
|
+
|
13
|
+
}
|
14
|
+
|
15
|
+
$minLevel = $levels[$found>=2 ? $found-2 : 0];
|
16
|
+
|
17
|
+
$maxLevel = $levels[$found+2 >= count($levels) ? count($levels) : $found+2];
|
18
|
+
|
19
|
+
```
|