Re: [PHP] Replace text

2001-10-27 Thread DL Neil

> Hello guys
>
> function replace_text_smiley(){
>
> global $comment;
> // To add a relation between a text smiley a an image smiley do this:
> // $faces["text smiley here"] = "img tag to image smile here";
>
> $faces[":)"] = "";
> $faces[":P"] = "";
> $faces[":D"] = "";
> $faces[":("] = "";
> $faces[";)"] = "";
>
> while(list($text,$image) = each($faces))
> {
> $comment = str_replace("$text","$image","$comment");
> }
>
> return $comment;
> }
>
> this function replaces faces to smilies images
>
> then in a separete file i use this function and another one to replace urls... the 
>url replacement is ok but
it doesn't change the text to smilies..
>
> any guesses?? :)

=do you really want those quotation marks in the str_replace function call?
=dn



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]




Re: [PHP] Replace text

2001-10-27 Thread Valentin V. Petruchek

What if pass some parameters to function - i mean not use global $comment
but
do like function replace_text_smiley($comment)
- Original Message -
From: "Daniel Harik" <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Sent: Sunday, October 28, 2001 12:20 AM
Subject: [PHP] Replace text


> Hello guys
>
> function replace_text_smiley(){
>
> global $comment;
> // To add a relation between a text smiley a an image smiley do this:
> // $faces["text smiley here"] = "img tag to image smile here";
>
> $faces[":)"] = "";
> $faces[":P"] = "";
> $faces[":D"] = "";
> $faces[":("] = "";
> $faces[";)"] = "";
>
> while(list($text,$image) = each($faces))
> {
> $comment = str_replace("$text","$image","$comment");
> }
>
> return $comment;
> }
>
> this function replaces faces to smilies images
>
> then in a separete file i use this function and another one to replace
urls... the url replacement is ok but it doesn't
> change the text to smilies..
>
> any guesses?? :)
>
> Thnx in advance
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, e-mail: [EMAIL PROTECTED]
> For additional commands, e-mail: [EMAIL PROTECTED]
> To contact the list administrators, e-mail: [EMAIL PROTECTED]
>
>



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]
To contact the list administrators, e-mail: [EMAIL PROTECTED]