Mailinglisten-Archive |
-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1
Sebastian Mendel schrieb:
> Michael Borchers schrieb:
>>> Ich habe ein array users_time_sum_array in folg. form:
>>>
>>> Array
>>> (
>>> [3] => Array
>>> (
>>> [0] => 3.00
>>> [1] => 1.50
>>> )
>>>
>>> [22] => Array
>>> (
>>> [0] => 5.25
>>> [1] => 6.55
>>> [2] => 8.00
>>> [3] => 4.30
>>> )
>>> }
>>>
>>> nun lese ich jeden key aus und summiere dann die dazugehörigen zahlen, ungefähr so:
>>>
>>> while($users_id = current($users_time_sum_array)) {
>>> $users_id = key($users_time_sum_array);
>>> $users_time_sum = array_sum($users_time_sum_array[$users_id]);
>>> next($users_time_sum_array);
>>> }
>>> das funzt wunderbar, aber gibt es so noch irgendeine mögl. die die ausgabe in der while schleifenach
>>> $users_time_sum zu sortieren? gibt es ne lösung, die das könnte?danke
>
> sieht komisch aus ... ;-)
>
> foreach ($users_time_sum_array as $user_id => $user_times) {
> $user_times[$user] = array_sum($user_times);
> }
>
> array_sort($user_times);
haha, natürlich:
foreach ($users_time_sum_array as $user_id => $user_times) {
$times[$user_id] = array_sum($user_times);
}
array_sort($times);
- --
Sebastian Mendel
www.sebastianmendel.de
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (MingW32)
iD8DBQFENSC1X/0lClpZDr4RAqaTAJ9+os59niwz42P4LGCiuVtEOgV0xACcDKjx
9Ixy5fK09Gm1Try01WOxwWg=
=8RJ1
-----END PGP SIGNATURE-----
php::bar PHP Wiki - Listenarchive