回答編集履歴
1
はいはい
answer
CHANGED
@@ -1,1 +1,9 @@
|
|
1
|
-
[array_seach](http://php.net/manual/ja/function.array-search.php)でキー(何番目か)が分かるので、+1,-1すればいいのでは?
|
1
|
+
[array_seach](http://php.net/manual/ja/function.array-search.php)でキー(何番目か)が分かるので、+1,-1すればいいのでは?
|
2
|
+
|
3
|
+
```php
|
4
|
+
$pos = array_search($this_id, $post_id_index, true);
|
5
|
+
$prev_pos = $pos - 1;
|
6
|
+
$next_pos = $pos + 1;
|
7
|
+
if($prev_pos < 0) $prev_pos = null;
|
8
|
+
if($next_pos >= count($post_id_index)) $next_pos = null;
|
9
|
+
```
|