str replace

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
User avatar
vio
Forum Newbie
Posts: 8
Joined: Thu May 23, 2002 8:03 am
Location: new york
Contact:

str replace

Post by vio »

what would be the full php tag to change text into an image like the smiley's. sometimes like someone gives me the code im not exactly sure where the hell im gonna put it, should it be as an include, should it not, etc, etc. :\ yea it sounds n00bish but this is a php board fer help.
jason
Site Admin
Posts: 1767
Joined: Thu Apr 18, 2002 3:14 pm
Location: Montreal, CA
Contact:

Post by jason »

Code: Select all

<?php

// $string is whatever text you want to replace =) with the image is
$string = str_replace('=)','<img src="smiley.jpg">', $string);
echo $string;

?>
That really should be it.
Post Reply