number of characters

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • InSeCo

    #1

    number of characters

    Hello,

    How do I count the numbers of charaters in a string/variabele?

    thnx,

    InSeCo



  • Scriptdude

    #2
    Re: number of characters

    InSeCo wrote:[color=blue]
    > Hello,
    >
    > How do I count the numbers of charaters in a string/variabele?
    >
    > thnx,
    >
    > InSeCo[/color]

    Including spaces and other non-printable characters?

    $num = strlen($mystrin g);

    Might wanna trim of extra spaces at the end first.

    $num = strlen(trim($my string));

    --
    ___| ___| _ \ _ _| _ \__ __| __ \ | | __ \ ____|
    \___ \ | | | | | | | | | | | | | __|
    | | __ < | ___/ | | | | | | | |
    _____/ \____|_| \_\___|_| _| ____/ \___/ ____/ _____|
    Computers will never take the place of books. You can't stand on a
    floppy disk to reach a high shelf.
    I thought 'Deep Throat' was a movie about a giraffe :/


    Comment

    • Kimmo Laine

      #3
      Re: number of characters

      "InSeCo" <luyendyk@yahoo .com.news> kirjoitti
      viestissä:d3qv5 5$q7p$1@reader1 0.wxs.nl...[color=blue]
      > Hello,
      >
      > How do I count the numbers of charaters in a string/variabele?
      >[/color]

      Since the concept of function reference is totally unknown to you, let me
      tell you about it. There's this website php.net where there is documented a
      great big collection of php functions. They are categorized for easy access.
      There, from the string functions, you would've found precisely what you were
      looking for: a function called strlen();

      See http://www.php.net/manual/en/function.strlen.php for details.

      In the future: please check the documentation before asking this simple
      questions that really aren't worth answering. It's there, online. All the
      time. You can download it in various formats...


      Comment

      Working...