...

View Full Version : splitting a word



govind1986
09-17-2009, 02:32 PM
hi friends
im doing a project.., in this userid login i want to check the uerid for eg.., 4 users are there., student,admin,parents,teachers., while they entered userid i want to check the first letter of the id with d.. hw its..?

bacterozoid
09-17-2009, 02:39 PM
Your question makes little sense, but if you're trying to check the first letter of a string, do this:


if($user_id[0] == 'd') {
// Do stuff
}

funnymoney
09-17-2009, 02:46 PM
if you want to list all the letters...


$string = "splitme";
$i = 0;
while($i < strlen($string)) {
print $string[$i]."<br />";
$i++
}



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum