[PHP] string size in bytes

2006-02-12 Thread benifactor
can someone point me in the right direction...

i need to know how many bytes are in a string

example: 

$string = blah;

string == how many bytes

also i need to know how to find out how fast a page renders

example;

page rendered in 1.114 seconds

any help would be greatly appreciated

thank you

Re: [PHP] string size in bytes

2006-02-12 Thread Philip Hallstrom

i need to know how many bytes are in a string

example:

$string = blah;

string == how many bytes


Well, if you're willing to ignore all the unicode stuff, you can use 
strlen() since 1 byte = 1 character.  Check that manpage to see if there's 
a unicode safe version.



also i need to know how to find out how fast a page renders

example;

page rendered in 1.114 seconds


microtime().

Call it at the beginning of your script, then at the end, and substract 
the two values to see how long it took.


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php



Re: [PHP] string size in bytes

2006-02-12 Thread Curt Zirzow
On Sun, Feb 12, 2006 at 08:13:42PM -0600, Philip Hallstrom wrote:
 i need to know how many bytes are in a string
 
 example:
 
 $string = blah;
 
 string == how many bytes
 
 Well, if you're willing to ignore all the unicode stuff, you can use 
 strlen() since 1 byte = 1 character.  Check that manpage to see if there's 
 a unicode safe version.

strlen will count bytes but not necessarily characters (if unicode
is used)

Curt.
-- 
cat .signature: No such file or directory

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php