<?php 
    function convert($keyword, $debug = false) {
       $wResult = preg_match_all('/I(?=[[:upper:]][[:lower:]])|[[:upper:]]{2,}|[[:upper:]][[:lower:]]*|[[:lower:]]+|\d+|#/u', $keyword, $matches);
       if($debug){
           var_dump($matches);
           var_dump($matches[0]);
           var_dump(implode(' ',$matches[0]));
       }
       return implode(' ',$matches[0]);
    }

 $search_keyword = array(
            "comeHEREtomorrow",
            "KissYouTODAY",
            "comeÜndeHere",
            "NEVERSAYIT",
            "2013willCome",
            "Before2013ends",
            "IKnowThat",
            "#whatiknow"
        );
        $need_keyword = array(
            "come HERE tomorrow",
            "Kiss You TODAY",
            "come Ünde Here",
            "NEVERSAYIT",
            "2013 will Come",
            "Before 2013 ends",
            "I Know That",
            "# whatiknow"
        ); 

 $search_keyword2 = array(
     "Icons"
    , "WellIKnowThat"
    , "ITan"
    , "whirlwind"
        );
        $need_keyword2 = array(
     "Icons"
    , "Well I Know That"
    , "I Tan"
    , "whirlwind"
        );     
echo "Initial Cases:\n";
        foreach ($search_keyword as $key => $w) {
            $wExpected = $need_keyword[$key];

            $wResult = convert($w);

            $check = strcmp($wExpected, $wResult);
            $checkWord = ( $check == 0 ? "SUCCESS" : "FAILURE" );

            echo "try $key,\t keyword: \"$w\" expected: \"$wExpected\" result: \"$wResult\" check: $check ($checkWord),\n";
        }



echo "\n\nSecondary Cases:\n";
        foreach ($search_keyword2 as $key => $w) {
            $wExpected = $need_keyword2[$key];

            $wResult = convert($w);

            $check = strcmp($wExpected, $wResult);
            $checkWord = ( $check == 0 ? "SUCCESS" : "FAILURE" );

            echo "try $key,\t keyword: \"$w\" expected: \"$wExpected\" result: \"$wResult\" check: $check ($checkWord),\n";
        }
?>