teng84 Posted August 22, 2007 Share Posted August 22, 2007 is there a predefine function that will list all months? the existing code here uses this $month['Month'] = " "; $month['Jan'] = "1"; $month['Feb'] = "2"; $month['Mar'] = "3"; $month['Apr'] = "4 "; $month['May'] = "5"; $month['Jun'] = "6"; $month['Jul'] = "7"; $month['Aug'] = "8"; $month['Sep'] = "9"; $month['Oct'] = "10"; $month['Nov'] = "11"; $month['Dec'] = "12"; i wonder if i can have a predefine function that will do something like that Link to comment https://forums.phpfreaks.com/topic/66081-solved-list-month-in-an-array/ Share on other sites More sharing options...
frost Posted August 22, 2007 Share Posted August 22, 2007 I am pretty sure you have to create your own arrays when dealing with months. Link to comment https://forums.phpfreaks.com/topic/66081-solved-list-month-in-an-array/#findComment-330497 Share on other sites More sharing options...
teng84 Posted August 22, 2007 Author Share Posted August 22, 2007 i also think that way but is there any shorter way to do this i hate this thing it consumes more lines and it looks messy Link to comment https://forums.phpfreaks.com/topic/66081-solved-list-month-in-an-array/#findComment-330500 Share on other sites More sharing options...
marcus Posted August 22, 2007 Share Posted August 22, 2007 Make your own functions so you only need to call it once. Link to comment https://forums.phpfreaks.com/topic/66081-solved-list-month-in-an-array/#findComment-330501 Share on other sites More sharing options...
teng84 Posted August 22, 2007 Author Share Posted August 22, 2007 im will put that in the function and i will only use that once but i just want to see "if any" other way of doing this Link to comment https://forums.phpfreaks.com/topic/66081-solved-list-month-in-an-array/#findComment-330502 Share on other sites More sharing options...
Fadion Posted August 22, 2007 Share Posted August 22, 2007 Guess there's no easy way but im not a time & date expert. What u can do to "automate" the proccess is by using a code like this: <?php $months = array(); for($i=1; $i <= 12; $i++){ $M = date("M", mktime(0, 0, 0, $i, 0, 0)); $m = date("m", mktime(0, 0, 0, $i, 0, 0)); $months[$M] = $m; } print_r($months); ?> Link to comment https://forums.phpfreaks.com/topic/66081-solved-list-month-in-an-array/#findComment-330506 Share on other sites More sharing options...
teng84 Posted August 22, 2007 Author Share Posted August 22, 2007 no predefine function so i guess i have to mark this solve anyways thanks guys @GuiltyGear i also thought about this as the last option but thanks again nice try ;D ;D ;D Link to comment https://forums.phpfreaks.com/topic/66081-solved-list-month-in-an-array/#findComment-330510 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.