Hello i have this Array.
How it possible to return the following results?
<?php
$elements=array(
array("class"=>"a"),
array("class"=>"b"),
array("class"=>"c"),
array("id"=>"d"),
array("style"=>"e"),
array("class"=>"f"),
array("id"=>"g")
); //end of array
/*
Results
class='a b c f' id='d g' style='e'
*/
?>
rpkamp
2
<?php
$elements=array(
array("class"=>"a"),
array("class"=>"b"),
array("class"=>"c"),
array("id"=>"d"),
array("style"=>"e"),
array("class"=>"f"),
array("id"=>"g")
); //end of array
$new=array();
foreach($elements as $element)
foreach($element as $k=>$v)
$new[$k][] = $v;
$temp = array();
foreach($new as $key=>$values)
$temp[] = $key . '="' . implode(' ', $values) . '"';
echo implode(' ', $temp);
?>
