Jump to content

what does this date code do


jim.davidson

Recommended Posts

I'm a little new to this and inherited some code.

 

I see this line of code but I don't know what it's suppose to do.

 

if(date(s)%2 == 0)

 

Can someone explain it to me?

I'm thinking the s should be in quotes and I don't know what the %2 does

 

Any guidance will be appreciated

Link to comment
https://forums.phpfreaks.com/topic/256119-what-does-this-date-code-do/
Share on other sites

the 's' should be in quotes, yes.

 

% is the modulous operator

 

This line basically says "only execute the following code on even-numbered seconds."

 

I don't know why they'd want that.  I also don't know why they used 's' instead of the more correct 'U'

Thank you very much, the code displays one image if even then another if odd. what I can't understand is why it worked as is before I inherited it, where now I get an error on the if(date(s) say it wants to know what s is.  That's why I thought it needed the quotes.

Maniac Dan,

 

Thank you very much I've been pulling my hair out trying to figure out why this code ran before but wouldn't run once we transfered it over to our server.  Evidently the server that it resided on before hasn't been updated.  There's lots of work to do, errors pop up everywhere.  I might just rewrite the whole thing.

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.