[PHP] words in a string

2001-11-17 Thread wloeffelholz

hey ..

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 ..

thnx for helping in foward

greetings

wolf.dietrich von loeffelholz


-- 
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] words in a string

2001-11-17 Thread Johan Holst Nielsen

 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; $isizeof($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]




Re: [PHP] words in a string

2001-11-17 Thread Julio Nobrega Trabalhando

if (ereg('special word', $string)) {
echo 'Found';
} else {
echo 'Not Found';
}

--

Julio Nobrega

No matter where you go, this.

[EMAIL PROTECTED] wrote in message
[EMAIL PROTECTED]">news:[EMAIL PROTECTED]...
 hey ..

 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 ..

 thnx for helping in foward

 greetings

 wolf.dietrich von loeffelholz




-- 
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]