Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP] Tablica zliczanie ?
Fifi209
post
Post #1





Grupa: Zarejestrowani
Postów: 4 655
Pomógł: 556
Dołączył: 17.03.2009
Skąd: Katowice

Ostrzeżenie: (0%)
-----


Otóż mam tablicę (dla przykładu) :

CODE

Array
(
[0] => Array
(
[0] => 2
[1] => gold ingots
)

[1] => Array
(
[0] => 93
[1] => gold coins
)

[2] => Array
(
[0] => 72
[1] => gold coins
)

[3] => a spellbook of dark mysteries
[4] => Array
(
[0] => 32
[1] => small rubies
)

[5] => glacier kilt
[6] => an abyss hammer
[7] => a havoc blade
[8] => a berserker
[9] => a mastermind shield
[10] => Ferumbras' hat
[11] => Array
(
[0] => 2
[1] => gold ingots
)

[12] => Array
(
[0] => 93
[1] => gold coins
)

[13] => Array
(
[0] => 78
[1] => gold coins
)

[14] => a spellbook of dark mysteries
[15] => Array
(
[0] => 32
[1] => small rubies
)

[16] => glacier kilt
[17] => an abyss hammer
[18] => a havoc blade
[19] => a berserker
[20] => a mastermind shield
[21] => Ferumbras' hat
[22] => Array
(
[0] => 2
[1] => gold ingots
)

[23] => Array
(
[0] => 93
[1] => gold coins
)

[24] => Array
(
[0] => 71
[1] => gold coins
)

[25] => a spellbook of dark mysteries
[26] => Array
(
[0] => 32
[1] => small rubies
)

[27] => glacier kilt
[28] => an abyss hammer
[29] => a havoc blade
[30] => a berserker
[31] => a mastermind shield
[32] => Ferumbras' hat
)


Teraz chciałbym jakoś zliczyć np. small rubies, glacier kilt etc. czyli wszystko co się powtarza do siebie dodać. (IMG:http://forum.php.pl/style_emoticons/default/haha.gif)

Ma ktoś pomysł? Bo już doprowadziłem ze stringu do takiego stanu, że wcale to nie powinno być trudne jednak mój umysł sobie o tej godzinie z tym nie radzi. (IMG:http://forum.php.pl/style_emoticons/default/haha.gif)
Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi (1 - 6)
tomsi
post
Post #2





Grupa: Zarejestrowani
Postów: 379
Pomógł: 45
Dołączył: 30.06.2007

Ostrzeżenie: (10%)
X----


http://www.webdeveloper.pl/manual/show.php?str=array


Funkcja array_count_values.
Go to the top of the page
+Quote Post
kallosz
post
Post #3





Grupa: Zarejestrowani
Postów: 272
Pomógł: 19
Dołączył: 29.07.2006

Ostrzeżenie: (10%)
X----


http://pl.php.net/manual/pl/function.array-count-values.php
Go to the top of the page
+Quote Post
tomsi
post
Post #4





Grupa: Zarejestrowani
Postów: 379
Pomógł: 45
Dołączył: 30.06.2007

Ostrzeżenie: (10%)
X----


No przecież taką funkcję mu podałem.
Go to the top of the page
+Quote Post
Fifi209
post
Post #5





Grupa: Zarejestrowani
Postów: 4 655
Pomógł: 556
Dołączył: 17.03.2009
Skąd: Katowice

Ostrzeżenie: (0%)
-----


A zabrał ktoś pod uwagę, iż jest to dwuwymiarowa tablica?
Go to the top of the page
+Quote Post
erix
post
Post #6





Grupa: Moderatorzy
Postów: 15 467
Pomógł: 1451
Dołączył: 25.04.2005
Skąd: Szczebrzeszyn/Rzeszów




Chyba zwrócił...

Mógłbyś z łaski swojej poczytać, co użytkownicy w komentarzach w manualu piszą, a nie walisz od razu na forum... Mamy Cię uczyć, żebyś przewijał stronę nieco niżej niż tylko manual...?
Go to the top of the page
+Quote Post
Fifi209
post
Post #7





Grupa: Zarejestrowani
Postów: 4 655
Pomógł: 556
Dołączył: 17.03.2009
Skąd: Katowice

Ostrzeżenie: (0%)
-----


Pozwól więc, jeżeli tak uważasz że przytoczę Ci właśnie ten fragment:

"This gives you:
Warning: Can only count STRING and INTEGER values...

Found no solution for this yet..."

I nie ja wymyśliłem to tylko jest to z manuala. (IMG:http://forum.php.pl/style_emoticons/default/winksmiley.jpg)

@edit
Temat do zamknięcia - poradziłem sobie jakoś...

Ten post edytował fifi209 6.06.2009, 19:03:31
Go to the top of the page
+Quote Post

Reply to this topicStart new topic
2 Użytkowników czyta ten temat (2 Gości i 0 Anonimowych użytkowników)
0 Zarejestrowanych:

 



RSS Aktualny czas: 23.08.2025 - 06:52