> What function can I use to replace just the first occurence > of a "," in a string?
Let's replace the first , with a ! and if , does not exist at all let's not replace anything. Change according to taste: $str = 'Hello, I love you!'; if (($pos = strpos($str, ',')) !== false) { $str{$pos} = '!'; } print $str; // Hello! I love you!'; print $pos; // 5 print $str{0}; // H print $str{5}; // ! Regards, Philip Olson -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php