★ wanayoo — archive 1999 http://fr.php.net/manual/function.str-replace.phpNouvelle recherche | Portail wanayoo
PHP Friday, April 13, 2001  
downloads | documentation | faq | support | reporting bugs | links 

search for in the  


previousstrtoupper
strtrnext

Last updated: Mon, 08 Jan 2001

str_replace

(PHP 3>= 3.0.6, PHP 4 )

str_replace --  Replace all occurrences of needle in haystack with str

Description

string str_replace (string needle, string str, string haystack)

This function replaces all occurences of needle in haystack with the given str. If you don't need fancy replacing rules, you should always use this function instead of ereg_replace().

Example 1. Str_replace() example


$bodytag = str_replace ("%body%", "black", "<body text=%body%>");
      

This function is binary safe.

Note: Str_replace() was added in PHP 3.0.6, but was buggy up until PHP 3.0.8.

See also ereg_replace() and strtr().

previousstrtoupper
strtrnext

Last updated: Mon, 08 Jan 2001
add note | about notes

show source | credits | mirror sites:  

Copyright © 2001 The PHP Group
All rights reserved.
This mirror generously provided by: L'Université Michel de Montaigne Bordeaux III
Last updated: Fri Apr 13 08:31:48 2001 MET DST