Code Duplication    Length = 9-12 lines in 3 locations

aircraft.php 1 location

@@ 22-30 (lines=9) @@
19
	if (empty($aircraft_types) || $aircraft_types[0]['aircraft_name'] == '') $aircraft_types = $Spotter->getAllAircraftTypes();
20
	$previous = null;
21
	print '<div class="alphabet-legend">';
22
	foreach($aircraft_types as $value) {
23
		$firstLetter = substr($value['aircraft_name'], 0, 1);
24
		if($previous !== $firstLetter)
25
		{
26
			if ($previous !== null) print ' | ';
27
			print '<a href="#'.$firstLetter.'">'.$firstLetter.'</a>';
28
		}
29
		$previous = $firstLetter;
30
	}
31
	print '</div>';
32
	$previous = null;
33
	foreach($aircraft_types as $value) {

airline.php 1 location

@@ 48-59 (lines=12) @@
45
	}
46
	$previous = null;
47
	print '<div class="alphabet-legend">';
48
	foreach($airline_names as $value) 
49
	{
50
		//echo $value['airline_name']."\n";
51
		//echo mb_substr($value['airline_name'],0,1).' - '.$value['airline_name']."\n";
52
		$firstLetter = mb_strtoupper(mb_substr($value['airline_name'], 0, 1),'UTF-8');
53
		if($previous !== $firstLetter)
54
		{
55
			if ($previous !== null) print ' | ';
56
			print '<a href="#'.$firstLetter.'">'.$firstLetter.'</a>';
57
		}
58
		$previous = $firstLetter;
59
	}
60
	print '</div>';
61
	$previous = null;
62
	foreach($airline_names as $value) {

airport.php 1 location

@@ 116-126 (lines=11) @@
113
	ksort($airport_names);
114
	$previous = null;
115
	print '<div class="alphabet-legend">';
116
	foreach($airport_names as $value) {
117
		$firstLetter = mb_strtoupper(mb_substr($value['airport_city'], 0, 1));
118
		if($previous !== $firstLetter)
119
		{
120
			if ($previous !== null){
121
				print ' | ';
122
			}
123
			print '<a href="#'.$firstLetter.'">'.$firstLetter.'</a>';
124
		}
125
		$previous = $firstLetter;
126
	}
127
	print '</div>';
128
	$previous = null;
129
	foreach($airport_names as $value) {