---
title: "Smileyfunktion"
type: "forum-thread"
url: "https://www.webforum.nu/amne/php/98899-smileyfunktion"
topic: "PHP"
topic_url: "https://www.webforum.nu/amne/php"
author: "Melea"
published: "2004-03-07T15:26:52.000Z"
updated: "2004-06-04T23:49:23.000Z"
replies: 5
views: 260
page: 1
pages: 1
language: "sv-SE"
site: "webForum — webforum.nu"
rights: "Upphovsrätten till varje inlägg tillhör dess författare."
attribution: "Citera som: webForum, https://www.webforum.nu/amne/php/98899-smileyfunktion"
---

# Smileyfunktion

## #1 — Melea, 2004-03-07T15:26Z

Hejsan!

Försöker bygga en smileyfunktion men får det inte riktigt att funka... får felmeddelandet

```
Call to undefined function: smiley()
```

Såhär ser koden ut

```php
function smiley($buffer) {
  $returnthis = str_replace(":(", "<img src='img/frown.gif'>", $buffer);
  $returnthis = str_replace(":)", "<img src='img/smile.gif'>", $returnthis);
  $returnthis = str_replace(";)", "<img src='img/wink.gif'>", $returnthis);
  $returnthis = str_replace(":$", "<img src='img/shame.gif'>", $returnthis);
  $returnthis = str_replace(":x", "<img src='img/angry.gif'>", $returnthis);
  $returnthis = str_replace(":beer:", "<img src='img/beergrin.gif'>", $returnthis);
  $returnthis = str_replace(":beer2:", "<img src='img/bire.gif'>", $returnthis);
  $returnthis = str_replace("8)", "<img src='img/cool.gif'>", $returnthis);
  $returnthis = str_replace("x(", "<img src='img/dead.gif'>", $returnthis);
  $returnthis = str_replace("(6)", "<img src='img/devel.gif'>", $returnthis);
  $returnthis = str_replace(":D", "<img src='img/supergrin.gif'>", $returnthis);
  $returnthis = str_replace(":flirt:", "<img src='img/dead.gif'>", $returnthis);
  $returnthis = str_replace(":/", "<img src='img/dead.gif'>", $returnthis);
  $returnthis = str_replace(":idea:", "<img src='img/dead.gif'>", $returnthis);
  $returnthis = str_replace(":DD", "<img src='img/laugh.gif'>", $returnthis);
  $returnthis = str_replace(":oo", "<img src='img/look.gif'>", $returnthis);
  $returnthis = str_replace(":?", "<img src='img/quest.gif'>", $returnthis);
  $returnthis = str_replace(":stud:", "<img src='img/stud.gif'>", $returnthis);
  $returnthis = str_replace(":P", "<img src='img/tongue.gif'>", $returnthis);
  return ($returnthis);
}

while ($result = mysql_fetch_array($results)) {

print smiley(nl2br($result['forumpost']));

}
```

Vad är det jag har missat? :OO

Tack på förhand

Permalänk: https://www.webforum.nu/p/98899

## #2 — voigtann1, 2004-03-07T15:55Z

varför?:

```
  $returnthis = str_replace(":(", "<img src='img/frown.gif'>", [b]$buffer[/b]);
  $returnthis = str_replace(":)", "<img src='img/smile.gif'>", [b]$returnthis[/b]);
```

Du kör två olika saker på det?

Permalänk: https://www.webforum.nu/p/1293724

## #3 — Melea, 2004-03-07T15:58Z

Jo vi kan ta och stryka det här inlägget eftersom det är ett stort skämt! Som vanligt postar jag inlägg innan jag ens vaknat :)

Tack för ert tålamod!

Mvh // Melea (ute på vift)

Permalänk: https://www.webforum.nu/p/1293727

## #4 — alj, 2004-03-07T16:07Z

Halv fem och du har inte vaknat, kan det bero på något annat  kanske?  :L

Permalänk: https://www.webforum.nu/p/1293732

## #5 — jwradhe, 2004-06-04T18:02Z

va va det som e fel? får samma problem men hittar ingen lösning :S

Permalänk: https://www.webforum.nu/p/1361247

## #6 — Peeer, 2004-06-04T23:49Z

> **jwradhe skrev:**
>
> va va det som e fel? får samma problem men hittar ingen lösning :S

Finns funktionen med på sidan som du försöker anropa den ifrån?

Permalänk: https://www.webforum.nu/p/1361351

---

Tråden på webben: https://www.webforum.nu/amne/php/98899-smileyfunktion
