Loading, please wait...

A to Z Full Forms and Acronyms

How to print the size of the empty class in PHP | PHP program

Jan 18, 2022 PHP, 922 Views
How to print the size of the empty class in PHP | PHP program

How to print the size of the empty class in PHP | PHP program

 We will define a class Student and then print the size of the object of the empty class using the sizeof() function.

<?php

class Student
{
}

$S = new Student();
echo "Size of object: " . sizeof($S);
?>
A to Z Full Forms and Acronyms