faqts : Computers : Programming : Languages : PHP : Common Problems : Strings

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

16 of 22 people (73%) answered Yes
Recently 8 of 10 people (80%) answered Yes

Entry

How can I strip items similar to [some text here] from a string?

Aug 24th, 2000 22:16
Ben Udall, Darin Beard, http://www.php.net/manual/function.str-replace.php


The str_replace() function is probably what you're looking for.
$str = "Hello world";
$new_str = str_replace("world", "", $str);
$new_str should now equal "Hello "