What is the difference between sizeof() and count() in PHP?

sizeof() is a function in PHP that returns the number of elements in an array, while count() is also a function that does the same thing. The main difference between the two is that sizeof() is an alias of count() and they can be used interchangeably. However, count() is more commonly used in PHP code.

// Example of using count() to get the number of elements in an array
$array = [1, 2, 3, 4, 5];
$length = count($array);
echo $length; // Output: 5