smiley umwandeln

Methos

Erfahrenes Mitglied
Hab grad folgendes versucht:

PHP:
<?php
$eintrag = ":p :lol:";
function smilie_umwandeln($eintrag) {
 $smilie = array(
  ",-)"        => '<img src="./smilies/smilie.gif" width="15" height="15">',
  ":-)"        => '<img src="./smilies/smilie1.gif" width="15" height="15">',
  ":-("        => '<img src="./smilies/smilie2.gif" width="15" height="15">',
  ";-)"        => '<img src="./smilies/smilie3.gif" width="15" height="15">',
  ":o"         => '<img src="./smilies/smilie4.gif" width="15" height="15">',
  ":D"         => '<img src="./smilies/smilie5.gif" width="15" height="15">',
  ":p"         => '<img src="./smilies/smilie6.gif" width="15" height="15">',
  ":cool:"     => '<img src="./smilies/smilie7.gif" width="21" height="15">',
  ":rolleyes:" => '<img src="./smilies/smilie8.gif" width="15" height="15">',
  ":mad:"      => '<img src="./smilies/smilie9.gif" width="15" height="15">',
  ":eek:"      => '<img src="./smilies/smilie10.gif" width="15" height="15">',
  ":confused:" => '<img src="./smilies/smilie11.gif" width="15" height="22">',
  ":drink:"    => '<img src="./smilies/smilie12.gif" width="60" height="40">',
  ":lol:"      => '<img src="./smilies/smilie13.gif" width="15" height="15">',
  ":crazy:"    => '<img src="./smilies/smilie14.gif" width="15" height="15">',
  ":dance:"    => '<img src="./smilies/smilie15.gif" width="32" height="32">',
  ":wink:"     => '<img src="./smilies/smilie16.gif" width="25" height="29">',
  ":jump:"     => '<img src="./smilies/smilie17.gif" width="31" height="31">',
  ":burnout:"  => '<img src="./smilies/smilie18.gif">',
  ":sp1:"      => '<img src="./smilies/smilie19.gif" width="45" height="24">',
  ":sp2:"      => '<img src="./smilies/smilie20.gif" width="20" height="20">',
  ":sp3:"      => '<img src="./smilies/smilie21.gif" width="34" height="40">',
  ":sp4:"      => '<img src="./smilies/smilie22.gif" width="45" height="20">',
  ":sp5:"      => '<img src="./smilies/smilie23.gif" width="15" height="15">',
  ":sp6:"      => '<img src="./smilies/smilie24.gif" width="85" height="33">'
  );

  for(reset($smilie); $key=key($smilie); next($smilie)) {
    $eintrag = str_replace("$key","$smilie[$key]",$eintrag);
  }
  return $eintrag;
}

echo $eintrag;
?>

Nur irgendwie werden die smileys nicht umgewandelt. Es erscheinen nur die :) usw.
 
Zurück