Jump to content

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

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.