How to check if $_GET is empty?

You can check if the $_GET array is empty by using the empty() function.

For example:

<?php

if (empty($_GET)) {
  // $_GET is empty
echo '$_GET is empty';
} else {
  // $_GET is not empty
echo '$_GET is not empty';
}

You can also use the count() function to check if the $_GET array has any elements:

<?php

if (count($_GET) === 0) {
  // $_GET is empty
echo '$_GET is empty';
} else {
  // $_GET is not empty
echo '$_GET is not empty';
}