I thought about using filesize, but this operation will be happening a lot meaning that I'd like to make it as efficient as possible and creating, modifying, and deleting a temporary file on each iteration probably isn't the best method to do that.
As for count, according to the page you sent me to, "count--Count elements in an array, or properties in an object"
It doesn't even seem to work for a string (only arrays and objects). But if it did, I'd imagine it would count the number of characters. Unfortunately, depending on what encoding is used, (UTF-8, etc) I can't be sure how many bytes a character is.
Any other suggestions?