How to know how many memories each variable in the PHP violination is



  • There was a need to know how much it takes. ОЗУ every variable in the PHP violin. There are ways, except writing a million times. memory_get_usage()?



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

Log in to reply
 


Suggested Topics

  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2
  • 2