answersLogoWhite

0

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

User Avatar

Wiki User

15y ago

What else can I help you with?

Related Questions

Code of find vowels in string in php?

$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;


How do you count the number of elements in an array using PHP?

Using the function "count". <?php $foo = array("John", "Jacob", "Jingleheimer", "Schmidt"); echo count($foo); // <-- outputs the number 4 ?>


How do you count the vowels in a string?

#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="<


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 find the length of string without using the strlen function in PHP?

$str = "Hello"; $nameArr=str_split($str); print_r($nameArr); echo "length: ".count($nameArr);


What is var char in php?

Varchar in SQL means string in PHP.


How do you remove whitespaces from a string in PHP?

<?php trim(ereg_replace( ' +', ' ', $extraWhiteSpace)); ?>


How to use strings with PHP and MySQL?

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')"; ?>


How do you decode to encode using md5 funcation in php?

md5() is one-way encryption method. Example: $test_string="php"; $md_encoded_string=md5($test_string); But, you can't decode the string back to php.So, if you need to check the entered string is php or not $user_entered_string=md5($_POST['user_input']); if($md_encoded_string == $user_entered_string) { echo "input matched"; }


How do you block swear words on webpages?

Using PHP for example and the string replacement attributed to replace the swear words with *** or something.


How do you reverse a string in PHP without using a function?

Without any function is impossible. So I'll assume you mean any coded function, in which case the predefined function below is your answer.$string = strrev($string);


How do you write a program in c sharp to identify whether a character vowels and consonants?

<html> <head> <title>Assignment1</title> </head> <body> Enter the String:<br><br> <form action="ass1.php" method="post"> Name: <input type="text" name="fname" /> <input type="submit" name="Submit" /> </form> <?php if(isset($_POST['Submit'])) { $vowels=array("a","e","i","o","u"); $length=strlen($_POST['fname']); $count = 0; for ($i = 0; $i!= $length; $i++) { if (array_search($_POST['fname'][$i], $vowels)) { $count++; } } } echo 'There are ('.$count.') vowels in the string ('. $_POST['fname'].')'; ?> </body> </html>