Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

> Połączenie wartości w tablicy
winiar789
post
Post #1





Grupa: Zarejestrowani
Postów: 130
Pomógł: 0
Dołączył: 15.11.2011

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


Mam coś takiego :

Array
(
[0] => Array
(
[data-position] => 1
[data-shopurl] =>nazwaa
[data-offer-price] =>
)

[1] => Array
(
[data-position] =>
[data-shopurl] =>
[data-offer-price] => 458.00
)

[2] => Array
(
[data-position] => 2
[data-shopurl] => nazwaa
[data-offer-price] =>
)

[3] => Array
(
[data-position] =>
[data-shopurl] =>
[data-offer-price] => 469.27
)
)

a chciałbym uzyskać:


Array
(
[0] => Array
(
[data-position] => 1
[data-shopurl] =>nazwaa
[data-offer-price] => 458.00
)

[1] => Array
(
[data-position] => 2
[data-shopurl] => nazwaa
[data-offer-price] => 469.27
)
)

Go to the top of the page
+Quote Post
 
Start new topic
Odpowiedzi
winiar789
post
Post #2





Grupa: Zarejestrowani
Postów: 130
Pomógł: 0
Dołączył: 15.11.2011

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


Nawet jak zamienie na $i++ to jest taka sama historia.

  1. echo "<pre>";
  2. for($i = 0; $i < count($tablica); $i++) {
  3. print_R($tablica[$i]);
  4. }
  5. echo "</pre>";


Zrobiłem coś takiego, brakuje mi tak naprawdę tylko tego aby połączyć te array
  1. echo "<pre>";
  2. for($i = 0; $i < count($tablica); $i++) {
  3. $result = array_diff($tablica[$i], array(''));
  4. print_R($result);
  5. }
  6. echo "</pre>";



Array
(
[data-position] => 1
[data-shopurl] => nazwaa1
)
Array
(
[data-offer-price] => 458.00
)
Array
(
[data-position] => 2
[data-shopurl] => nazwaa2
)
Array
(
[data-offer-price] => 469.27
)
Array
(
[data-position] => 3
[data-shopurl] => nazwaa3
)
Array
(
[data-offer-price] => 489.94
)
Go to the top of the page
+Quote Post

Posty w temacie


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: 15.10.2025 - 18:19