Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> [PHP] Problem z count
Lwik
post 7.12.2012, 15:28:14
Post #1





Grupa: Zarejestrowani
Postów: 39
Pomógł: 8
Dołączył: 11.05.2012

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


Witam, mam malutki problem z count, mianowicie niezależnie od liczby danych w obiekcie zwraca mi jeden, oto przykładowy wypis z kodu;
KOD
  1. $wymagania = json_decode($item['wymog']);
  2. $tekst = "";
  3. $surowce = count($wymagania->surowce, COUNT_RECURSIVE);
  4. /*
  5. Dane do wypisu poniżej.
  6. */
  7. print_r($wymagania->surowce);
  8. echo '<br />';
  9. print_r($surowce);
  10. echo '<br />';
  11. for($i=0;$i<$surowce;$i++)
  12. {
  13. // petla
  14. }

  1. stdClass Object
  2. (
  3. [0] => 0
  4. [1] => 7
  5. )
  6. Ilość: 1

Cała JSON
  1. stdClass Object
  2. (
  3. [surowce] => stdClass Object
  4. (
  5. [0] => 0
  6. [1] => 7
  7. )
  8.  
  9. [ilosc] => stdClass Object
  10. (
  11. [0] => 3
  12. [1] => 12
  13. )
  14.  
  15. [inne] => stdClass Object
  16. (
  17. [0] => 1
  18. [1] => 2
  19. )
  20.  
  21. [inneilosc] => stdClass Object
  22. (
  23. [0] => 2
  24. [1] => 5
  25. )
  26.  
  27. )


Jakieś pomysły?

Ten post edytował Lwik 7.12.2012, 15:29:59
Go to the top of the page
+Quote Post

Posty w temacie
- Lwik   [PHP] Problem z count   7.12.2012, 15:28:14
- - redeemer   Ponieważ jak widać 'surowce' to nie tablic...   7.12.2012, 15:38:26


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

 



RSS Wersja Lo-Fi Aktualny czas: 14.08.2025 - 02:21