I am trying to figure out the size of a variable in php.
The reason i need to do this is because if it is over 1mb i need to use a different form of caching rather than memcache as memcache has a limit of 1mb.
I am using the below:
$start_memory = memory_get_usage();
$this->results= $dataReader->readAll();
$this->end_memory = memory_get_usage() - $start_memory;
The results are coming back as 50mb which is very inaccurate. I have looked at str length also but the data is an array. Can someone let me know the most accurate way of detecting the size of a variable in php.