$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;
Its similar to a number of languages such as C, C++, Java and Perl.
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.
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: <?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; ?> <a href="weblink">convert-text-to-speech</a>
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).
Changing the input language of a textbox from English to Hindi in PHP involves setting the lang attribute to "hi" 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.
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
The eval() function evaluates a string as PHP code. http://us.php.net/manual/en/function.eval.php
<?php trim(ereg_replace( ' +', ' ', $extraWhiteSpace)); ?>
Varchar in SQL means string in PHP.
If you will see this example as below, this may help. <?php $string = mysql_real_escape_string($string); $sql = "insert into stringtable(mystring) values('$string')"; ?>
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.
$string ="Guess my length"; $length = strlen($string); now the $length will have the length of the string.
Use the substr function. For example <?php $name= "naruto uzumaki"; echo substr($name, 0, 6) ; // The first six char are taken by this code ?> This will output naruto
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. <?php $my_text = "Hello"; echo strlen($my_text); // outputs 5 ?>
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 <?php ?>. PHP is mix of few languages so semantics is mixed too.
#include #include void main() { char string[50]; int vowel=0,consonant=0; cout<<"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<<"No of vowels="<<<"\nNo of consonants="<
We can use php tags in different ways. <?php //php code to be written here ?> OR <? //php code ?> This tag will not work when we using editors such as macromedia dreamweaver. OR < script language="php"> //php code </script>