View difference between Paste ID: WSvqnauL and MqxMEwsP
SHOW: | | - or go back to the newest paste.
1
<?php
2
3
$names = Array
4
(
5
0 => Array('idn' => '8','name' => 'Петя',),
6
1 => Array('idn' => '7','name' => 'Ира',),
7
2 => Array('idn' => '3','name' => 'Вася',),
8
3 => Array('idn' => '5','name' => 'Дима',),
9
4 => Array('idn' => '6','name' => 'Семен',),
10
5 => Array('idn' => '1','name' => 'Влад',),
11
6 => Array('idn' => '2','name' => 'Глеб',),
12
7 => Array('idn' => '4','name' => 'Юля',),
13
8 => Array('idn' => '9','name' => 'Таня',)
14
);
15
16
$count = count($names);
17
18
if ($count > 0) {
19
	echo "<ul>\n";
20
}
21
22
for ($i = 0; $i < $count; $i++) {
23
	echo '<li>' . $names[$i]['name'] . ':' . $names[$i]['idn'] . "</li>\n";
24-
	if (((($i+1) % 3) == 0) || $i == $count) { 
24+
	if (((($i+1) % 3) == 0) || $i+1 == $count) { 
25
		echo "</ul>\n";
26
		if ($i+1 !== $count) {
27
			echo "<ul>\n";		
28
		}
29
	}
30
31
}