PHP 8.5.0 Alpha 4 available for testing

Voting

: one plus two?
(Example: nine)

The Note You're Voting On

jpeter1978 at yahoo dot com
17 years ago
I tried all the suggestions above for getting the object size (in bytes) for $memsize, but they didn't work universally for the two types of objects I tried (string and array of strings).

After doing some googling and experimenting, I've found the following magic formula:

$memsize = ( strlen( serialize( $object ) ) + 44 ) * 2;

I found this in someone else's code, so I can't explain it.

<< Back to user notes page

To Top