Return to Snippet

Revision: 1984
at December 8, 2006 20:25 by vanity


Initial Code
function RemoveShouting($string)
{
 $lower_exceptions = array( 
       "to" => "1", "a" => "1", "the" => "1", "of" => "1"
 ); 
 
 $higher_exceptions = array(  
       "I" => "1", "II" => "1", "III" => "1", "IV" => "1",  
       "V" => "1", "VI" => "1", "VII" => "1", "VIII" => "1",
       "XI" => "1", "X" => "1", "GAs"=>'1'
 ); 
 
 $words = split(" ", $string); 
 $newwords = array(); 
 foreach ($words as $word)
 {
  if (!$higher_exceptions[$word]) $word = strtolower($word);
  if (!$lower_exceptions[$word]) $word[0] = strtoupper($word[0]);
  array_push($newwords, $word);
 }
 return join(" ", $newwords);
}

Initial URL
http://www.subeta.org

Initial Description

                                

Initial Title
Remove Shouting

Initial Tags
php

Initial Language
PHP