| |
|
|
| | помогите ПАЖАЛУСТА....
как просортировать двумерный массив $glob_array по $t_n_c_array[1]
я недаганяю(.
$teach_arr = file("db/db.dat");
$count = count($teach_arr);
//$amount_all_percent = "";
for($i = 0; $i < $count; $i++)
{
$entry = trim($teach_arr[$i]);
$p = strcspn($entry,"|");
$t_n_c_array[0] = substr($entry,0,"$p");
$p++;
//$amount_all_percent = $amount_all_percent + $t_n_c_array[0];
$t_n_c_array[1] = substr($entry,"$p");
$glob_array[$i] = $t_n_c_array;
}
|
| |
| |
|
|
| |
|
|
| |
для: deman-b
(28.08.2006 в 22:17)
| | | тема исчерпана.... я рещил эту прблему...
<?php
$data_base = "db/db";
$teach_arr = file($data_base);
$count = count($teach_arr);
for($i = 0; $i < $count; $i++)
{
$separator = "|";
$sep_len = strlen($separator);
$entry = trim($teach_arr[$i]);
$p = strcspn($entry,$separator);
$val = substr($entry,0,"$p");
$p = $p + $sep_len;
$key = substr($entry,"$p");
//$amount_all_percent = $amount_all_percent + $key;
$glob_array[$key] = $val;
}
ksort($glob_array);
while($index = each($glob_array))
{
print "Голосов:".$index[1]." За: ".$index[0]."<br>";
}
?>
|
| |
| |
|
|