Try the following code, please note you may want to trim() the string as
well if it is coming from a user.
Jason
On Sun, 2003-01-12 at 10:32, [EMAIL PROTECTED] wrote:
> I want to count characters without space "character".
> $char="hello world"
> so the result should be 10.
> Can anybody help
On Sun, 12 Jan 2003 [EMAIL PROTECTED] wrote:
> I want to count characters without space "character".
> $char="hello world"
> so the result should be 10.
> Can anybody help me?
$char="hello world";
$temp=str_replace(" ", "", $char);
echo strlen($temp);
should give you 10.
RDB
>
>
>
--
> who knowes how to count the charcaters in a string without the space
> character?
Using a regular expression to strip out all the spaces before passing to the
word counting function seems easiest. You'll be left to adapt it to PHP, but
the regexp is: 's/ //g' That removes all spaces. If it gives
On Saturday 11 January 2003 08:51 pm, [EMAIL PROTECTED] wrote:
> who knowes how to count the charcaters in a string without the space
> character?
you need to be more clear.
number of characters in the string except space?
number of distinct characters in the string except space?
include other no
4 matches
Mail list logo