ex)
echo substr_count($story, "like"); // Prints: 8
문장에 해당 단어가 몇개 있는지 표시하는 함수
ex)
echo strrev("Hello, World!"); // Prints: !dlroW ,olleH
문장을 거꾸로 표시하는 함수
ex
echo strtolower("HeLLo"); // Prints: hello
해당 부분을 소문자로
echo str_repeat("hi", 10); // Prints: hihihihihihihihihihi
해당 부분을 반복해서 표시
function calculateDistance($first, $second)
{
return abs($first - $second);
}
function calculateTip($cost_of_a_meal)
{
return round($cost_of_a_meal * 1.18);
}
echo calculateTip(100);
$max = getrandmax();
echo $max;
echo rand(); // Prints a number between 0 and $max
echo rand(1,52); // Prints a number between 1 and 52
echo rand(1, 52); 은 1과 52사이에 숫자중 하나를 랜덤으로 뽑는다.
str_pad ( string $input , int $pad_length [, string $pad_string = " " [, int $pad_type = STR_PAD_RIGHT ]] ) : string
str_pad ( string $input , int $pad_length [, string $pad_string = " " [, int $pad_type = STR_PAD_RIGHT ]] ) : string
function calculateCircleArea($diameter)
{
return pi() * ($diameter/2)**2;
}