I'm trying to figure out how many bytes are in a very long string. Anyone know how to do this? I've tried:
$content_length=strlen($text_in_a_variable);
but that doesn't work. It's close, but not quite.
I'm trying to figure out how many bytes are in a very long string. Anyone know how to do this? I've tried:
$content_length=strlen($text_in_a_variable);
but that doesn't work. It's close, but not quite.
Yes, one byte per character. How is it wrong and how are you finding the right value?
I was feeding the output of my script into a Flash movie that displayed the number of bytes loaded. I didn't realize my script was spitting out an error message that made my Flash movie think it was getting data of various lengths...because it was.
I was also under the impression that characters in PHP were more than a byte in length, but I guess not. Now that I fixed my syntax, everything is working fine using strlen(). Thanks anyway.
Originally posted by minorgod
characters in PHP were more than a byte in length, but I guess not.
They can be, but if they are you'll know about it, because you have to make a deliberate effort to use the multibyte string functions.