Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Aug 2009
    Posts
    12
    Thanks
    0
    Thanked 0 Times in 0 Posts

    splitting a word

    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..?

  • #2
    Regular Coder bacterozoid's Avatar
    Join Date
    Jun 2002
    Location
    USA
    Posts
    490
    Thanks
    24
    Thanked 35 Times in 35 Posts
    Your question makes little sense, but if you're trying to check the first letter of a string, do this:

    PHP Code:
    if($user_id[0] == 'd') {
        
    // Do stuff


  • #3
    Regular Coder funnymoney's Avatar
    Join Date
    Aug 2007
    Posts
    364
    Thanks
    17
    Thanked 24 Times in 24 Posts
    if you want to list all the letters...
    PHP Code:
    $string "splitme";
    $i 0;
    while(
    $i strlen($string)) {
    print 
    $string[$i]."<br />";
    $i++



  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •