I found some code and I was hoping someone could better explain to me why it was written this way. I know what the code is doing (obviously from the variable names) but I'm confused as to some of the way it was written.
$month = ($_GET['month'] == "" ? date("m") : $_GET['month']);
$year = ($_GET['year'] == "" ? date("Y") : $_GET['year']);
This is the beginning of a script so there are no links (yet). Why is the month variable inside of the _$GET[]? What does the ? mean and why is there a colon in the middle?
$num_days_in_month = date("t",mktime(12,0,0,$month,1,$year));
$monthname = date("F",mktime(12,0,0,$month,1,$year));
In this, I don't understand why the hour started with 12.
Is there any way that might be easier to write the above code?
Thanks for any help you all can provide. 🙂