Jump to content

question about a certain format?


yazakib

Recommended Posts

I haven't programmed in PHP in awhile, and i probably just never have seen anyone format something in this way, but I was just curious about it.  I was looking around to find scripts/tutorials for making a dynamic calendar (go back and forth between months as well as post events to the calendar)

 

and it starts out by defining the month and year variables like this

 

    $m = (!$m) ? date("m",mktime()) : "$m";

    $y = (!$y) ? date("Y",mktime()) : "$y";

 

i've never seen that before so i'm baffled can someone enlighten me?  I understand the date("y", mktime()) function, i just dont know what the first part and the last part are for the \"(!$y) ?\" and \": "$y"\"

 

they also go on to use it again at the end when creating the heading for the calendar

<?php echo $_SERVER['PHP_SELF']; ?>?m=<?=(($m-1)<1) ? 12 : $m-1 ?>&y=<?=(($m-1)<1) ? $y-1 : $y ?>

 

and i just dont understand.  I know that it creates a link to the next month, and the ?m&y represent the month and year in the link, but what is all the rest?

 

any help would be great

 

-brodie

 

Link to comment
https://forums.phpfreaks.com/topic/117759-question-about-a-certain-format/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.