| | |||||
| ||||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | THREAD STARTER #1 (permalink) |
| NamePros Regular Join Date: Dec 2006
Posts: 236
![]() | |
| | |
| | #2 (permalink) |
| NamePros Regular Join Date: Apr 2006
Posts: 360
![]() ![]() ![]() ![]() | looks like you want to use string replace, if your altering every letter in a sentence/text then you would probably want to traverse the string as an array and make the new string like this: PHP Code: Cheers, Jay
__________________ Canadian Domain Registrar Ready.ca |
| | |
| | THREAD STARTER #3 (permalink) |
| NamePros Regular Join Date: Dec 2006
Posts: 236
![]() | Thanks baxter for your reply. I am still having some problems making it work. Can you help me with this code: The code below works fine until I change "Hällo World of PHP" to “$text” with the same text from the DB. when I echo the variable the text appears without the changed characters. What am I doing wrong? This works: $vowels = array("ä"); $onlyconsonants = str_replace($vowels, "ä", "Hällo World of PHP"); This doesn’t work: $vowels = array("ä"); $onlyconsonants = str_replace($vowels, "ä", “$text”); |
| | |
| | #4 (permalink) | ||||
| Senior Member Join Date: Oct 2007 Location: Sydney, Australia
Posts: 1,022
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() |
$onlyconsonants = str_replace($vowels, "ä", $text); If you are just trying to change those funny letters to their html encoded equivalent (e.g. ä to ä), you could try the htmlentities() php function - PHP: htmlentities - Manual | ||||
| | |
| | THREAD STARTER #5 (permalink) | ||||
| NamePros Regular Join Date: Dec 2006
Posts: 236
![]() |
This code does everything I wanted and more.????: NamePros.com http://www.namepros.com/showthread.php?t=669125 $text=htmlentities($text); | ||||
| | |