> i want php to do an IF, when he founds a special word in a string (ex: > text_-_write_-_text ) .. i m not able to manage it ..
<?php function doThis($x) { //something? $result = $x." phplover"; return $result; } $string = "Hi whats your name? Hi whats your name?"; $string_arr = explode(" ", $string); $newstring = "" for($i=0; $i<sizeof($string_arr); $i++) { if($string_arr[$i] == "Hi") { //Or ereg if the word only have to contain $string_arr[$i] = doThis($string_arr[$i]); } $newstring .= " ".$string_arr[$i]; } //Return Hi phplover whats your name? Hi phplover whats your name? echo $newstring; ?> Could you use this example? Regards, Johan -- 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]