text 'tidy up' function

PHP programming forum. Ask questions or help people concerning PHP code. Don't understand a function? Need help implementing a class? Don't understand a class? Here is where to ask. Remember to do your homework!

Moderator: General Moderators

Post Reply
mrgooding
Forum Newbie
Posts: 23
Joined: Thu May 22, 2008 11:45 am

text 'tidy up' function

Post by mrgooding »

Hi All

Just a quick question on a function to tidy up text - I can't seem to work out whether my function is incorrect or the way i'm trying to use it is correct:

Code: Select all

function tidytext($textstring)
{
$textstring = ucfirst(strtolower($textstring));
return $textstring;
}   
Is the function itself, and:

Code: Select all

$text1='iAMbadlyforMATTED';
tidytext($text1);
Echo $text1;
still echo's iAMbadlyforMATTED, not Iambadlyformatted, as i'd hoped.

Any ideas why this won't work? Cheers in advance.
mrgooding
Forum Newbie
Posts: 23
Joined: Thu May 22, 2008 11:45 am

Re: text 'tidy up' function

Post by mrgooding »

solved it - had forgotten to put $text1 = tidytext($text1);

Hope this helps somebody!
Post Reply