I have an array of 18 values:
$array = array(\'a\', \'b\', \'c\', \'d\', \'e\', \'f\', \'g\', \'h\', \'i\', \'j\', \'k\', \'l\', \'m\', \'n\', \'o\', \'p\',
You can use array_chunk
and array_merge
for this problem:
';
print_r($merged_array);
?>
And You will get the result like this:
Array
(
[0] => Array
(
[0] => a
[1] => b
)
[1] => Array
(
[0] => c
[1] => d
)
[2] => Array
(
[0] => e
[1] => f
)
[3] => Array
(
[0] => g
[1] => h
)
[4] => Array
(
[0] => i
[1] => j
)
[5] => Array
(
[0] => k
[1] => l
)
[6] => m
[7] => n
[8] => o
[9] => p
[10] => q
[11] => r
)
This is what exactly you want.
Live Demo Here>>