QUOTE(swordz @ Sep 17 2008, 09:49 PM)

I hate regex, so I give no guarantee.
preg_match('/^[aeiou]|s\z/i', $string)
Come back if it doesn't work, someone else may have replied with the correct answer by then.
swordz
I tested it swordz, and it does seem to work, how i used it:
CODE
<?php
$yourstring = "ITeFvaello";
$loweredstring = strtolower($yourstring[0]);
function checkifvowel($string) {
if(preg_match('/^[aeiou]|s\z/i', $string))
{
echo 'match';
}else{
echo 'no match';
}
}
checkifvowel($loweredstring);
?>
QUOTE(Aeonsky @ Oct 15 2008, 10:37 PM)

This should do it...
CODE
<?php
$a = "ITeFvaello";
$f = strtolower($a[0]);
function checkifvowel($v) {
if ($v == "a" || $v == "e" || $v == "i" || $v == "o" || $v == "u")
echo "First letter is a vowel!"; else echo "It is not a vowel!";
}
checkifvowel($f);
?>
I think in my opinion it's a bit poor programming and looks tacky having multiple || in one statement. If you were forced to use it i would suggest you use an array. There are two ways that this can be done. Could be with a loop as i have shown below:
CODE
<?php
$yourstring = "ITeFvaello";
$loweredstring = strtolower($yourstring[0]);
function checkifvowel($string) {
$vowel =array('a','e','i','o','u');
$i=0;
while($i < count($vowel)) {
if($string==$vowel[$i])
{
echo 'First letter is a vowel!';
}
$i++;
}
}
checkifvowel($loweredstring);
?>
Or you could just use a function called in_array(). This does pretty much what the above does but with less lines of code, (ie eliminating us implementing a while loop, an example of this i have written and shown below:
CODE
<?php
$yourstring = "ITeFvaello";
$loweredstring = strtolower($yourstring[0]);
function checkifvowel($string) {
$vowel =array('a','e','i','o','u');
if(in_array($string, $vowel))
{
echo 'Word begins with a vowel';
}
}
checkifvowel($loweredstring);
?>