goma smile Posted September 2, 2010 Report Share Posted September 2, 2010 Sveik kā var saskaitī vissus kkas kopā ? Array ( [01] => Array ( [kkas] => 478 ) [02] => Array ( [kkas] => 516 ) [03] => Array ( [kkas] => 527 ) [04] => Array ( [kkas] => 580 ) [05] => Array ( [kkas] => 618 ) [06] => Array ( [kkas] => 452 ) [07] => Array ( [kkas] => 457 ) } Quote Link to comment Share on other sites More sharing options...
briedis Posted September 2, 2010 Report Share Posted September 2, 2010 Izej ciklā cauri un saskaiti. Nezini tādu foreach ciklu? Quote Link to comment Share on other sites More sharing options...
Grey_Wolf Posted September 2, 2010 Report Share Posted September 2, 2010 (edited) Izej ciklā cauri un saskaiti. Nezini tādu foreach ciklu? un PHP iebuuvetas masiivu funkcijas atceltas ? array_sum Edited September 2, 2010 by Grey_Wolf Quote Link to comment Share on other sites More sharing options...
briedis Posted September 2, 2010 Report Share Posted September 2, 2010 Nu nav gan, bet nu goma smile jau vismaz varēja izdomāt, kā to izdarīt kaut vai ar ciklu. Ja viņš pat to nevar, domā viņš spēs vēl pielietot divreiz funkciju array_values() ? $sum = array_sum(array_values(array_values($arr))); Quote Link to comment Share on other sites More sharing options...
goma smile Posted September 2, 2010 Author Report Share Posted September 2, 2010 (edited) Liekot šitā foreach($report as $sKey){ echo '<pre>'; print_r($sKey['kkas']); } izvadās šitas 478 516 527 580 618 452 457 tālāk to array sum ? Edited September 2, 2010 by goma smile Quote Link to comment Share on other sites More sharing options...
briedis Posted September 2, 2010 Report Share Posted September 2, 2010 Tas ko iedevu nestrādā? Quote Link to comment Share on other sites More sharing options...
goma smile Posted September 2, 2010 Author Report Share Posted September 2, 2010 Tas ko iedevu nestrādā? Visādi provēju, bet nejiet ... Quote Link to comment Share on other sites More sharing options...
Grey_Wolf Posted September 2, 2010 Report Share Posted September 2, 2010 (edited) izvadās šitas 478 516 527 tālāk to array sum ? a parastaa saskaitiisana + nestraadaa? ja jau visu dzen cauri ar foreach tad kur problema vienkarshi visu saskaitiit kopaa ? Edited September 2, 2010 by Grey_Wolf Quote Link to comment Share on other sites More sharing options...
euphoric Posted September 2, 2010 Report Share Posted September 2, 2010 Palasi komentārus , tur ir piemēri kā `rekursīvi` iziet cauri masīvam un saskaitīt.. Quote Link to comment Share on other sites More sharing options...
goma smile Posted September 2, 2010 Author Report Share Posted September 2, 2010 Nu nav gan, bet nu goma smile jau vismaz varēja izdomāt, kā to izdarīt kaut vai ar ciklu. Ja viņš pat to nevar, domā viņš spēs vēl pielietot divreiz funkciju array_values() ? $sum = array_sum(array_values(array_values($arr))); atgriež 0 Quote Link to comment Share on other sites More sharing options...
goma smile Posted September 2, 2010 Author Report Share Posted September 2, 2010 Paldies ir :) Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.