doubledee Posted April 25, 2011 Share Posted April 25, 2011 In my Payment Form, I have an ExpMonth (e.g. '01') and ExpYear (e.g. '2011'). Each value is assigned to $expMonth and $expYear respectively. I then need to combine them and keep the format ('MMYYYY'). I am afraid that this code may truncate leading zeros... $expDate = $expMonth . $expYear Will my code work, or do I need to do something else to ensure the Month stays ('MM') and the year stays ('YYYY')? Debbie Quote Link to comment Share on other sites More sharing options...
kenrbnsn Posted April 25, 2011 Share Posted April 25, 2011 Did you try it? It works fine. Ken Quote Link to comment Share on other sites More sharing options...
doubledee Posted April 25, 2011 Author Share Posted April 25, 2011 Did you try it? It works fine. Ken With PHP's dynamic typing I thought it might strip off the leading zeros and convert the string values into integers... Debbie Quote Link to comment Share on other sites More sharing options...
Fadion Posted April 25, 2011 Share Posted April 25, 2011 With PHP's dynamic typing I thought it might strip off the leading zeros and convert the string values into integers... Debbie It is called Week Typing (aka Loose Typing) actually. And no, truncation can't occur as you're concatenating strings and the result will obviously be a string. Quote Link to comment Share on other sites More sharing options...
doubledee Posted April 25, 2011 Author Share Posted April 25, 2011 With PHP's dynamic typing I thought it might strip off the leading zeros and convert the string values into integers... Debbie It is called Week Typing (aka Loose Typing) actually. And no, truncation can't occur as you're concatenating strings and the result will obviously be a string. Okay, but my fear was that it would convert '02' to '2' and then concatenate... Anyways... Thanks, Debbie Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.