80 bytes
. This is because even an empty class will have a few attributes and methods in PHP.<?php
class EmptyClass {}
$obj = new EmptyClass();
echo "Size of empty class: " . memory_get_usage(true) . " bytes";
?>
Size of empty class: 2097152 bytes
memory_get_usage(true)
` function returns the amount of memory used by the script in bytes. By default, it returns the memory used by the PHP engine, but passing `true
` as an argument makes it return the actual memory usage of the script.