Note: this solution actually works as proven. This was underestimated for some unclear reason.
, , , , ( )
<?php
$arr = [0=>'a',8=>'b',2=>'c',7=>'d',9=>'e',11=>'f'];
for($i=0;$i<count($arr);$i++)
$arr[key($arr)] = ["current" => current($arr), "next" => next($arr)];
echo '<pre>';
print_r($arr);
OUTPUT
Array
(
[0] => Array
(
[current] => a
[next] => b
)
[8] => Array
(
[current] => b
[next] => c
)
[2] => Array
(
[current] => c
[next] => d
)
[7] => Array
(
[current] => d
[next] => e
)
[9] => Array
(
[current] => e
[next] => f
)
[11] => Array
(
[current] => f
[next] =>
)
)
- current()
, next()
key()
, .