Home > Archive > PHP Language > April 2005 > number of characters
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
number of characters
|
|
| InSeCo 2005-04-16, 3:56 pm |
| Hello,
How do I count the numbers of charaters in a string/variabele?
thnx,
InSeCo
| |
| Scriptdude 2005-04-16, 3:56 pm |
| InSeCo wrote:
> Hello,
>
> How do I count the numbers of charaters in a string/variabele?
>
> thnx,
>
> InSeCo
Including spaces and other non-printable characters?
$num = strlen($mystring);
Might wanna trim of extra spaces at the end first.
$num = strlen(trim($mystring));
--
___| ___| _ \ _ _| _ \__ __| __ \ | | __ \ ____|
\___ \ | | | | | | | | | | | | | __|
| | __ < | ___/ | | | | | | | |
_____/ \____|_| \_\___|_| _| ____/ \___/ ____/ _____|
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 :/
| |
| Kimmo Laine 2005-04-16, 3:56 pm |
| "InSeCo" <luyendyk@yahoo.com.news> kirjoitti
viestissä:d3qv55$q7p$1@reader10.wxs.nl...
> Hello,
>
> How do I count the numbers of charaters in a string/variabele?
>
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...
| |
| Scriptdude 2005-04-19, 3:57 am |
| InSeCo wrote:
> Hello,
>
> How do I count the numbers of charaters in a string/variabele?
>
> thnx,
>
> InSeCo
Including spaces and other non-printable characters?
$num = strlen($mystring);
Might wanna trim of extra spaces at the end first.
$num = strlen(trim($mystring));
--
___| ___| _ \ _ _| _ \__ __| __ \ | | __ \ ____|
\___ \ | | | | | | | | | | | | | __|
| | __ < | ___/ | | | | | | | |
_____/ \____|_| \_\___|_| _| ____/ \___/ ____/ _____|
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 :/
| |
| Kimmo Laine 2005-04-19, 8:55 am |
| "InSeCo" <luyendyk@yahoo.com.news> kirjoitti
viestissä:d3qv55$q7p$1@reader10.wxs.nl...
> Hello,
>
> How do I count the numbers of charaters in a string/variabele?
>
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...
|
|
|
|
|