- array_map: documentation ( source)
- array_chunk: documentation ( source)
- print_r: documentation ( source)
- implode: documentation ( source)
- explode: documentation ( source)
<?php
$str = <<<STR
Height:
3/16
Color:
Standard Red
Material:
Die-cut, pressure-sensitive paper
Package Quantity:
1000/Pkg
Reusable:
Yes
Size:
3/16 H x 1/4 W
STR;
$lines = explode("\n", $str);
$combined = array_map(
function($line) { return implode(' ', $line); },
array_chunk($lines, 2)
);
print_r($combined);