Exemple #1
0
}
echo allUpper('tarmo dulinets') . '<br/>';
// eemaldab sulud ja jutumärgid
function stripQuotesAndParenthesis($string)
{
    $string = trim($string, '"() ');
    return $string;
}
echo stripQuotesAndParenthesis('("In Transition 2.0")') . '<br/>';
// teisendab kõik tähed väiketähtedeks
function lowerCase($string)
{
    $string = mb_strtolower($string, 'UTF-8');
    return $string;
}
echo lowerCase('("In Transition 2.0")') . '<br/>';
// teisendab kõik tähed suurtähtedeks
function upperCase($string)
{
    $string = mb_strtoupper($string, 'UTF-8');
    return $string;
}
echo upperCase('("In Transition 2.0")') . '<br/>';
// arvu süntaksi muutmine
function alterFloat($float)
{
    $float = number_format($float, 1, ',', ' ');
    return $float;
}
echo alterFloat(2015.16);
?>
// Make a function that takes in a string and returns it capitalized. If the input is not a string, return false.
// Make a function that takes in a string and returns it lowercased. If the input is not a string, return false.
// Write a function called isVowel that takes in a single character and returns true if the character is a vowel, false if not.
// Write a function called countVowels that takes in a string and returns the number of vowels in the string.
function square($number)
{
    $square = $number * $number;
    return $square;
}
echo square(7);
//
function upperCase($string)
{
    if (!is_string($string)) {
        return false;
    }
}
return strtoupper($string);
echo upperCase([]);
echo upperCase("foo");
//
function lowerCase($string)
{
    if (!is_string($string)) {
        return false;
    }
}
return strtolower($string);
echo lowerCase([]);
echo lowerCase("FOO");
//