function getError($edu, $kirjutamisel, int $i) { $edu = ucword($edu); $vahe = $i++; $summa = $edu + $kirjutamisel; $mingiTehe = $edu - $vahe + $edu; echo $summa . " ei tea midagi"; $edu = mb_strtolower($edu); if ($i > 0) { $i = -10; $edu = getError($i, $kirjutamisel); $edu = ucfirst . getError; } return $edu; }
/** This function will split a sentence into separate words. Sentences will be split on normal word boundaries, such as spaces,tabs,newlines, but also when a bracket (,{,[,],},) are encountered. All space will be preserved however and restored to the final string. This function will also recognise Roman numerals from I to XX (1-20) and if they are already UPPERCASE, will maintain case. This function differs from ucwords, in that it will set all other characters in a word to lowercase! */ function initcap($text) { $word = ''; $rtext = ''; for ($i = 0; $i < strlen($text); $i++) { // We might be in the middle of a word. if (strlen($word) > 0 || is_alpha($text[$i])) { // test for end of word. if (strlen($word) > 0 && is_nonword_char($text[$i])) { $rtext .= ucword($word); $word = ''; $rtext .= $text[$i]; } else { $word .= $text[$i]; } } else { //just copy it to return array. $rtext .= $text[$i]; } } // Do final word. if (strlen($word) > 0) { $rtext .= ucword($word); $word = ''; } return $rtext; }