$newData = array();
foreach ($data[0] as $key => $v) {
$newData[$key] = array_column($data, $key);
}
$data[0]
поэтому, если$data = array(
array( 'x' => '1', 'y' => '1' ),
array( 'x' => '2', 'y' => '2', 'z' => '2' ),
array( 'x' => '3', 'y' => '3', 'z' => '3' ),
array( 'x' => '4', 'y' => '4', 'z' => '4' )
);