Possible Duplicate:
Is there a way I get the size of a PHP variable in bytes?
I need to find the size in bytes using php for int/char or an array . I think its possible with memory management in php .
Possible Duplicate:
Is there a way I get the size of a PHP variable in bytes?
I need to find the size in bytes using php for int/char or an array . I think its possible with memory management in php .
/* load before whit a value */
$before = memory_get_usage(FALSE);
/* make sure $temp dosn't have a content before */
$temp = NULL;
/* calculate current usage */
$before = memory_get_usage(FALSE);
/* copy the content to a nex varibale */
$temp = $variable_to_test . '';
/* calculate the new usage */
$after = memory_get_usage(FALSE);
/* clean up data */
unset($temp);
/* calculate the incresed memory usage */
$memory_usage = $after - $before;