I'm trying to create a smiley filter. been working on it for 2 hours now and frustrated. can anyone give me any pointers. here is how my stuff works.
user inputs a message into a text input form.
form is processed by script, and all the input is assigned to $message.
example: "hello everyone. i am posting picture.gif !!! This is fun" is submitted by form.
the variable $message now holds the above in quotations.
what i need to do is
open directory /images/
read the directory, and make a list or array of every picture.gif contained in that directory.
create some kind of foreach or for loop, that goes through $message and checks every word in the string, and if it matches any of the pictures.gif in the array containing the valid images, then replaces the specific word in $message , such as picture.gif , with <img src=/images/$picture.gif>
any ideas? ive been close a few times. but it just lead to frustration.