Re: calculate bytes in string
| From: | Ian Newlands | Date: | Sun, 10 Nov 2002 00:07:03 +0000 |
| Subject: | Re: calculate bytes in string | ||
| References: | 1 2 3 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-123638@lists.php.net to get a copy of this message | ||
This was exactly what I was trying to avoid. See I was porting a reporting
module to write .XLS files to a database, rather than to files. It's easier
for me to clean up old reports that way.
Anyway, thanks for your help!
Regards,
Ian Newlands
"@ Edwin" <copperwalls@hotmail.com> wrote in message
news:OE54PDGNZzahL7szm8x00001367@hotmail.com...
> Or,
>
> "Jason Wong" <php-general@gremlins.com.hk> wrote:
>
> > On Saturday 09 November 2002 14:22, Ian Newlands wrote:
> > > Does anyone know of a function, or a method to calculate how many
bytes
> are
> > > in a string? Similar to the filesize file system function.
> > >
> > > Any help would be appreciated.
> >
> > Assuming 1 character = 1 byte, then strlen().
> >
>
> Just write the string to a file first then check the filesize. This should
> work (I think)
> even if you're dealing with multi-byte characters wherein 1 character = 2
> bytes
> (or more?).
>
> There's mb_strlen() but I don't think it'll be useful though...
>
> - E