Horst: Elemente zw. 2 Variablen extrahieren

Beitrag lesen

Hi Lars,

probiers mal hiermit:

<?php
$string = "Hallo {qwer}was auch {immer} {i} {horst}";

preg_match_all ("/({)([a-zA-Z0-9]+)(})/", $string, $matches);

for ($i=0; $i< count($matches[0]); $i++) {
  echo "matched: ".$matches[0][$i]."<br>";
  echo "part 1: ".$matches[1][$i]."<br>";
  echo "part 2: ".$matches[2][$i]."<br>";
  echo "part 3: ".$matches[3][$i]."<br>";
}

?>

hier die Erklärung dazu:
http://www.php.net/manual/de/function.preg-match-all.php
Beispiel 2

Gruss
Horst
und ... geht mal schalfen: Gute Nacht