Jump to content

show last part of array, same order, no duplicates


jasonc

Recommended Posts

I wish to get only the last part of each array 'g'

And then show non duplicated 'g'

but in the same order that it was in the original array.

 

 

<?php
$formarray = array(
'name' => array(
      'i1'=>      array('a'=>'a1', 'b'=>'b1', 'c'=>'c1', 'd'=>'d1', 'e'=>'e1', 'f'=>'f1', 'g'=>'g1'),
      'i2'=>      array('a'=>'a2', 'b'=>'b2', 'c'=>'c2', 'd'=>'d2', 'e'=>'e2', 'f'=>'f2', 'g'=>'g2'),
      'i3'=>      array('a'=>'a3', 'b'=>'b3', 'c'=>'c3', 'd'=>'d3', 'e'=>'e3', 'f'=>'f3', 'g'=>'g3'),
      'i4'=>      array('a'=>'a4', 'b'=>'b4', 'c'=>'c4', 'd'=>'d4', 'e'=>'e4', 'f'=>'f4', 'g'=>'g4'),
      )
);

foreach ($formarray as $newarray => $a) {
	?><strong><?=$newarray;?></strong><br><?
  				foreach ($a as $key => $k) {
				?>"<?=$key;?>", <?
				foreach ($k as $b) {
					//if ($k['DBfield'] != "") {
					?>"<?=$b;?>", <?
					//}
				}
				?><br><?
			} //end of second foreach
	?><br><br><br><?
} //end of first foreach
?>

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.