[ create a new paste ] login | about

Link: http://codepad.org/jHMUfvwP    [ raw code | output | fork ]

PHP, pasted on Aug 18:
1
2
3
4
5
6
7
8
9
10
11
<?php

$array = array('A','B','C','D','E','F','G','H','I');
$seperation = 3;
$assoc = array(); // stores result

for($i = 0; $i+$seperation < count($array); $i++) {
   $assoc[$array[$i]] = $array[$i + $seperation];
}

print_r($assoc);


Output:
1
2
3
4
5
6
7
8
9
Array
(
    [A] => D
    [B] => E
    [C] => F
    [D] => G
    [E] => H
    [F] => I
)


Create a new paste based on this one


Comments: