There is a need to find out how much ОЗУ each variable in the PHP script takes. Are there ways other than writing a million times memory_get_usage() ?

2 answers 2

 function sizeofvar($var) { $start_memory = memory_get_usage(); $tmp = unserialize(serialize($var)); return memory_get_usage() - $start_memory; } 

    I cannot translate and copy-paste, and the point is.?

    I can advise the tool that I used, there is xdebug , it is included in phpExpertEditor PHPDesigner and in the standard PCP library but is disabled in php.ini

    then you can google xdebud and customize it for yourself. He is not complicated.

    • why so many cons? xdebug shows how much and after what actions resources were eaten, what's the problem ???? - Vladimir Ch