Witaj Gościu! ( Zaloguj | Rejestruj )

Forum PHP.pl

 
Reply to this topicStart new topic
> [PHP]Nadawanie indexu w tablicy
Wolfie
post
Post #1





Grupa: Zarejestrowani
Postów: 686
Pomógł: 0
Dołączył: 10.11.2008
Skąd: Łódź

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


Witam

Siedze nad tymi tablicami i chyba mi sie w glowie juz miesza bo to raczej proste zagadnienie ale nie moge dojsc do tego

Mam taki kawalek kodu :

  1. foreach($struct as $st) {
  2. $section = mailparse_msg_get_part($mime, $st);
  3. $info = mailparse_msg_get_part_data($section);
  4. //print_r($info);
  5. if($info['headers']['subject'] !== null && $info['headers']['date'] !== null) {
  6. $part[]['subjects'] = $info['headers']['subject'];
  7. $part[]['date'] = $info['headers']['date'];
  8. }
  9. }


W efekcie czego dostaje taka tablice :

Cytat
Array ( [0] => Array ( [subjects] => Generic Cialis, branded quality@ ) [1] => Array ( [date] => Sun, 08 Apr 2007 21:00:48 +0300 ) [2] => Array ( [subjects] => [R] Confidence-Intervals.... help... ) [3] => Array ( [date] => Sun, 8 Apr 2007 10:19:39 -0700 (PDT) ) [4] => Array ( [subjects] => For Smile ) [5] => Array ( [date] => Sun, 8 Apr 2007 17:20:59 +0300 ) [6] => Array ( [subjects] => Less weight - more pleasure and joy ) [7] => Array ( [date] => Sun, 8 Apr 2007 17:22:07 -0100 ) [8] => Array ( [subjects] => Anatrim will change your life ) [9] => Array ( [date] => Sun, 8 Apr 2007 17:22:19 -0100 ) [10] => Array ( [subjects] => problems in animal studies using rats or rabbits feeding outdoor ) [11] => Array ( [date] => Sun, 8 Apr 2007 19:24:35 +0200 ) [12] => Array ( [subjects] => We cure any desease! ) [13] => Array ( [date] => Sun, 08 Apr 2007 13:21:56 +0100 ) )


No i teraz jak widac 'subject' jest w tablicy o indeksie [0] zas 'date' w tablicy o indeksie [1].
Ja chce natomiast osiagnac taki efekt aby zarowno 'subject' jak i 'date' były w tablicy o indeksie [0], kolejny 'subject' i 'date' w tablicy o indeksie [1] itd......

Teoretycznie daloby sie to zrobic w petli for nadajac te same indeksy w tablicy $part[] ale w tym jest problem ze tablicy $info nie moge nadac indeksu......

Ten post edytował Wolfie 25.10.2009, 20:34:18
Go to the top of the page
+Quote Post
nospor
post
Post #2





Grupa: Moderatorzy
Postów: 36 557
Pomógł: 6315
Dołączył: 27.12.2004




no nic dziwnego skoro za kazdym razem wkladasz te wartosci jako kolejne elementy tablicy...
  1. $part[] = array(
  2. 'subjects' => $info['headers']['subject'],
  3. 'date' => $info['headers']['date']
  4. );


--------------------

"Myśl, myśl, myśl..." - Kubuś Puchatek || "Manual, manual, manual..." - Kubuś Programista
"Szukaj, szukaj, szukaj..." - Kubuś Odkrywca || "Debuguj, debuguj, debuguj..." - Kubuś Developer

Go to the top of the page
+Quote Post
Wolfie
post
Post #3





Grupa: Zarejestrowani
Postów: 686
Pomógł: 0
Dołączył: 10.11.2008
Skąd: Łódź

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


heh, wiedzialem ze rozwiazanie bedzie banalne winksmiley.jpg
Go to the top of the page
+Quote Post

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 Aktualny czas: 21.08.2025 - 19:16