answersLogoWhite

0

$vowel_arr=array('a','e','i','o','u');

$string="This is my sentence";

$len=strlen($string);

$vowel_cnt=0;

for($i=0;$i<$len;$i++)

{

if(in_array($string[$i],$vowel_arr))

$vowel_cnt++;

else

continue;

}

echo "Total Vowel count is: ".$vowel_cnt;

User Avatar

Wiki User

13y ago

What else can I help you with?

Continue Learning about Linguistics

The PHP syntax is similar to which languages?

Its similar to a number of languages such as C, C++, Java and Perl.


How can you create a language converter for website in English to Spanish in PHP?

You can use PHP to create a language converter for a website by storing language translations in a database or files, and then using PHP to dynamically switch the content based on the selected language. You can create language files for each language, and then use PHP sessions or cookies to store the user's language preference across pages. Finally, use PHP functions to display the content in the appropriate language based on the user's selection.


How do you convert Text-to-Speech with PHP?

I have used festival with PHP for TTS program. Its very simple to use. If you are running linux, you can simply use "yum install festival" command to install festival package. This package is required for TTS program to work. Windows users can use cygwin to build festival package and place its .so file bin directory of PHP. Once you are done with installation of festival, you can move on to write PHP code that will convert your text to voice recording. Following is the code that creates recording from your text. I have written text into the variable that you can change: &lt;?php //create a random number filename $filename = 'test.txt'; $text = 'This text will be converted to audio recording'; $outputfile = basename($filename, ".txt"); $outputfile = $outputfile . '.wav'; if (!$handle = fopen($filename, "w")) { return false; } // Write $text to our opened file. if (fwrite($handle, $text) === FALSE) { //couldn't write the file. Check permissions return false; } fclose($handle); //initialise and execute the festival C engine $cmd = "text2wave $filename -o $outputfile"; //execute the command exec($cmd); unlink($filename); echo "Recording is successful. \nRecording File: " . $outputfile; //finally return the uptput file path and filename return $outputfile; ?&gt; &lt;a href="weblink"&gt;convert-text-to-speech&lt;/a&gt;


How much is the salary of a Spanish speaking CSR in the Philippines?

I work as a Spanish-Speaking CSR. As with other (call-center CSR rates), they pay premium to experience. My first job as (with no experience yet) was Php 42,100.00. After a year I was recruited/pirated by a neighboring competitor and offered what seems to be +50%. I'm now at Php 63,150.00/month. (that's before taxes, of course).


How do you change the input language of a textbox from English to Hindi using PHP?

Changing the input language of a textbox from English to Hindi in PHP involves setting the lang attribute to &quot;hi&quot; in the input tag. This informs the browser that the expected language of the entered text should be Hindi. Additionally, you can utilize JavaScript to provide a virtual Hindi keyboard for users to input text easily in Hindi.

Related Questions

How do you count the vowels in a string using PHP?

build an array of vowels then do a foreach on the array and then explode the string on the array value and the answer is -1 of the result


What does the php function eval?

The eval() function evaluates a string as PHP code. http://us.php.net/manual/en/function.eval.php


How do you remove whitespaces from a string in PHP?

&lt;?php trim(ereg_replace( ' +', ' ', $extraWhiteSpace)); ?&gt;


What is var char in php?

Varchar in SQL means string in PHP.


How to use strings with PHP and MySQL?

If you will see this example as below, this may help. &lt;?php $string = mysql_real_escape_string($string); $sql = "insert into stringtable(mystring) values('$string')"; ?&gt;


What is difference between php and ruby on rails?

PHP is a scripting language while Ruby on Rails is a framework based on ruby programming language. PHP is easy to learn and code while Ruby is hard to learn and code. PHP Code is a mess and difficult to find particular functions or code while ROR follows systematic development and you can easily find the required function.


How do you get the length of an ANSI string using PHP?

$string ="Guess my length"; $length = strlen($string); now the $length will have the length of the string.


How do you take substring from a given string in php?

Use the substr function. For example &lt;?php $name= "naruto uzumaki"; echo substr($name, 0, 6) ; // The first six char are taken by this code ?&gt; This will output naruto


How do you check the length of a string in PHP?

It is fairly simple to check the length of a string in PHP. All you need to do is use the function strlen(). Below is an example of how it is used. &lt;?php $my_text = "Hello"; echo strlen($my_text); // outputs 5 ?&gt;


What are semantics in PHP?

PHP is related with HTML. HTML can be included into PHP script as well as PHP script can be included into HTML code. PHP begins and ends with &lt;?php ?&gt;. PHP is mix of few languages so semantics is mixed too.


How do you count the vowels in a string?

#include #include void main() { char string[50]; int vowel=0,consonant=0; cout&lt;&lt;"Enter the string"; cin.getline(string,50); for(int i=0;string[i]!='\0';i++) { switch (string[i]) { case 'a': case 'A': case 'e': case 'E': case 'i': case 'I': case 'o': case 'O': case 'u': case 'U':vowel++; continue; } if (string[i]!=' ') consonant++; } cout&lt;&lt;"No of vowels="&lt;&lt;&lt;"\nNo of consonants="&lt;


What is syntax in php?

We can use php tags in different ways. &lt;?php //php code to be written here ?&gt; OR &lt;? //php code ?&gt; This tag will not work when we using editors such as macromedia dreamweaver. OR &lt; script language="php"&gt; //php code &lt;/script&gt;