preg_match

From: Date: Sat, 02 Aug 2003 23:55:19 +0000
Subject: preg_match
Groups: php.general 
Request: Send a blank email to php-general+get-158060@lists.php.net to get a copy of this message
Hello, I would like to split a String containing ingredience with additional assigned footnotes... my problem I only get the first ingredience ($zutat at line 32 has only one times the awaited value) but the print on line 29 shows me that the value of $zutat is right at this point. what's wrong ????
      1 <?php
      2
      3 $products_ingredience = 'Gersten-Grütze²*, Gerstenmehl²*, Haferflocken*, Gemüse 12 % (Lauch*, Möhren*, Zwiebeln*), Haferkleie*, Steinsalz, Petersilie*, Kartoffelstärke*, Hefeextrakt, Sellerieblatt*, Kurkuma*, Muskatnuß*, Pfeffer*, Liebstöckl*';
      4
      5 ArtikelZutaten ($products_ingredience);
      6
      7
      8 function ArtikelZutaten($products_ingredience) {
      9
     10
     11 print "\n\n\n$products_ingredience)";
     12         $Zutaten = explode(",", $products_ingredience);
     13
     14         foreach ($Zutaten as $zutat) {
     15                 if (preg_match("/\²/", $zutat))
     16                         $FussnoteID = 2;
     17                 else
     18                         $FussnoteID = '';
     19
     20                 if (preg_match("/¹/", $zutat))
     21                         $FussnoteID = 1;
     22
     23                 if (preg_match("/\*/", $zutat))
     24                         $kbA = 1;
     25                 else
     26                         $kbA = 0;
     27
     28                 preg_match("/\b.*\b/", $zutat, $matches);
     29 print "\n-->>$zutat";
     30                 $zutat = $matches[0];
     31
     32 print "\nZutat $zutat FussnotenID $FussnoteID kbA $kbA";
     33
     34         }
     35
     36 }
     37
     38 ?>
mfg - micha

« previous php.general (#158060) next »