Forum Moderators: coopster

Message Too Old, No Replies

how to remove spaces from a function and make lowercase

         

lindajames

10:54 am on Oct 24, 2004 (gmt 0)

10+ Year Member



hello,

i have a function called display() and on my page i echo it like this

echo display();

the echo output displays some text, but i want it to remove all the spaces that the display function shows and also convert everything to lowercase.

i know i can use the replace function or something like that but dont know how it works, any help would be great.

thanx

Warboss Alex

12:06 pm on Oct 24, 2004 (gmt 0)

10+ Year Member



function display($content) {

//trim, strip excess whitespace
$content = preg_replace("/ +/", " ", trim($content));
//trim spaces
$content = str_replace(" ", "", $content);
//to lower case
$content = strtolower($content);

return $content;

}

Should do you.