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 2 of 2
  1. #1
    New Coder
    Join Date
    Mar 2007
    Posts
    91
    Thanks
    2
    Thanked 0 Times in 0 Posts

    I have peoples name variable $name, how to count how many characters for each name?

    i have a field, the field name is name, like
    John
    Robert
    etc

    the variable to call name is $name



    now i need to display how many characters each name have, for example
    John : 4 characters
    Robert : 6 character

    how to get characters numbers by using the name variable $name, what is the query looks like?


    thank you & GBU for all that helping
    Whats up

  • #2
    God Emperor Fou-Lu's Avatar
    Join Date
    Sep 2002
    Location
    Saskatoon, Saskatchewan
    Posts
    16,979
    Thanks
    4
    Thanked 2,659 Times in 2,628 Posts
    The function you need is strlen(). Give the variable (or a string if you want) to the strlen, and it'll return the number of chars in it.
    PHP Code:
    header('HTTP/1.1 420 Enhance Your Calm'); 


  •  

    Posting Permissions

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