jimfog Posted June 13, 2012 Share Posted June 13, 2012 The code that follows outputs the date as css class in a td element: id=dateid_'.$year.str_pad(date('m', $month),2,'0', STR_PAD_LEFT).str_pad($datecount, 2, '0', STR_PAD_LEFT). This a segment, enough though to draw a conclusion-I believe, hopefully. And here is what is output in the browser: <td class="weekdaysid=dateid_20120601">1</td> The PHP code above outputs the ...id=dateid_20120601 and it is here that my q comes and is related with the str_pad function According to the PHP manual if the pad length is equal to the input string then no padding takes place.So, in the code we have a pad length of 2 and the input string is always 2 characters since date('m') outputs the month as 2 digits. So is there a reason for having a pad length of 2 here? Link to comment Share on other sites More sharing options...
Ingolme Posted June 13, 2012 Share Posted June 13, 2012 No, no reason. Who gave you this code? Link to comment Share on other sites More sharing options...
jimfog Posted June 13, 2012 Author Share Posted June 13, 2012 I think it was dsonesuk sometime ago(I am almost sure he was him). Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now