TheFilmGod Posted June 27, 2009 Share Posted June 27, 2009 // Add contents to month array for (var cal_num = 0; cal_num <= 12; cal_num++) { month[cal_num] = month_name[cal_num]; } What's wrong with this? Link to comment https://forums.phpfreaks.com/topic/163893-ive-been-banging-my-head-for-ages-over-this/ Share on other sites More sharing options...
corbin Posted June 27, 2009 Share Posted June 27, 2009 Did you declare month before the loop? Also, why are you doing that? Why not just do: month = month_name; ? Link to comment https://forums.phpfreaks.com/topic/163893-ive-been-banging-my-head-for-ages-over-this/#findComment-864703 Share on other sites More sharing options...
xenophobia Posted June 28, 2009 Share Posted June 28, 2009 That will loop 13 times. Are you sure? Link to comment https://forums.phpfreaks.com/topic/163893-ive-been-banging-my-head-for-ages-over-this/#findComment-864901 Share on other sites More sharing options...
TheFilmGod Posted June 28, 2009 Author Share Posted June 28, 2009 Good point about the 13 times. Its a calendar so it should only loop 12 times. Yes, I declared the variable beforehand. I'm just playing around w/ the code. I'll completely revamp it tomorrow morning. It's getting really late. Thanks guys! Link to comment https://forums.phpfreaks.com/topic/163893-ive-been-banging-my-head-for-ages-over-this/#findComment-864912 Share on other sites More sharing options...
Ken2k7 Posted June 28, 2009 Share Posted June 28, 2009 Why not do something like this - var month = new Array('January', 'February', ...); month[0] = 'January' It's essentially the same thing you're doing there except your method is redundant. Link to comment https://forums.phpfreaks.com/topic/163893-ive-been-banging-my-head-for-ages-over-this/#findComment-864916 Share on other sites More sharing options...
TheFilmGod Posted June 28, 2009 Author Share Posted June 28, 2009 although the code excerpt makes it seem like I'm being redundant, the month array will be an extremely long string. The month name is the first portion of the string. Link to comment https://forums.phpfreaks.com/topic/163893-ive-been-banging-my-head-for-ages-over-this/#findComment-865090 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.