You could do it like this:
<?php
// Data Source
$array = array("x=1","y=2","y=3","z=3");
// Helper Function
function parseArray($array)
{
// Init
$parsed_array = array();
// Process Array
foreach ($array as $item) {
list($key, $value) = explode('=', $item);
$parsed_array[$key][] = $value;
}
// Finished
return $parsed_array;
}
// Usage
var_dump(parseArray($array));
Output:
If you want it to display it in like the said format; this is what you do this:
// Usage
$parsed_data = parseArray($array);
echo "<table border='1'>";
echo "<tr><th>". implode('</th><th>', array_keys($parsed_data)) ."</th></tr>";
echo "<tr>";
foreach ($parsed_data as $key => $values) {
echo '<td>'.implode(',', $values).'</td>';
}
echo "</tr>";
echo "</table>";
Outputs: