<?php
function Yuanyincount ($STR)
{
$str _len=strlen ($STR);
$a _count=0;
$e _count=0;
$i _count=0;
$o _count=0;
$u _count=0;
$other _count=0;
Array of five reason letters, no write output
$a _arr=array ();
$e _arr=array ();
$i _arr=array ();
$o _arr=array ();
$u _arr=array ();
$other _arr=array ();
$yuanyin _arr=array ();//inverse array
$temp = ";
for ($i =0; $i < $str _len; $i + +) {
$temp =substr ($str, $i, 1);//
$temp =strtolower ($temp);//Don't consider the case first
Switch ($temp) {
Case ' a ':
$a _count++;
$a _arr[]= $temp;
Break
Case ' E ':
$e _count++;
$e _arr[]= $temp;
Break
Case ' I ':
$i _count++;
$i _arr[]= $temp;
Break
Case ' O ':
$o _count++;
$i _arr[]= $temp;
Break
Case ' U ':
$u _count++;
$u _arr[]= $temp;
Break
Default
$other _count++;
$other _arr[]= $temp;
Break
}
}
The number of echoes ' vowel letters is ', $a _count+ $e _count+ $i _count+ $o _count+ $u _count, ' <br/> ';
The number of ECHO ' letters A is: ', $a _count, ' <br/> ';
The number of ECHO ' letter E is: ', $e _count, ' <br/> ';
The number of ECHO ' Letter B is: ', $i _count, ' <br/> ';
The number of echo ' O ' letters is: ', $o _count, ' <br/> ';
The number of echo ' Letters U is: ', $u _count, ' <br/> ';
}
function Getmicrotime ()
{
//
List ($usec, $sec) =explode (", Microtime ());
return (float) $usec + (float) $sec);
}
Record start time
$starttime =getmicrotime ();
echo yuanyincount (' Dfjkfdhjgjhfsdaoijiaoiaoko ');
Place the code to execute
For example Echo createpwd ();
Record End time
$endtime =getmicrotime ();
$time = $endtime-$starttime;
echo ' Execution time '. $time, ' <br/> ';
function Jutice_huiwen ($STR) {
Determines whether the input string is a palindrome
$str _rev=strrev ($STR);
if ($str = = = $str _rev) {
Echo $str, ' is a palindrome number ', ' <br/> ';
}else{
echo $str, ' not a palindrome number ';
}
}
echo Jutice_huiwen (' racecar ');
Test output:
The number of vowel letters is 10
The number of letters A is: 3
The number of letters E is: 0
The number of letter B is: 3
The number of Letter O is: 4
The number of letter U is: 0
Execution Time 0.042128086090088
Racecar is a palindrome number
Determines whether the input string is a palindrome number