Php:检查是否存在查询以及是否传递GET参数的可靠方法

Really new to PHP...

I would like to have a PHP interface which takes day, month, and year arguments as 'd', 'm', 'y', where the default values are simply pulled from the current date.

My thinking is that that should look something like this:

$day = isset($_GET) && isset($_GET['d']) ? $_GET['d'] : date('d');

But I seem to be missing something. Do I need the first isset($_GET) or is that redundant?

$_GET is always going to be set, so yes - that part is redundant.

$day = isset($_GET['d']) ? $_GET['d'] : date('d');

This would be fine for any PHP version, including PHP 5.x.

In PHP 7 you can shorten this by using the null coalescing operator:

$day = $_GET['d'] ?? date('d');