3v4l.org

run code in 300+ PHP versions simultaneously
<?php /* draws a calendar */ function draw_calendar($month,$year){ /* draw table */ $calendar = '<table cellpadding="0" cellspacing="0" class="calendar">'; /* table headings */ $headings = array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday'); $calendar.= '<tr class="calendar-row"><td class="calendar-day-head">'.implode('</td><td class="calendar-day-head">',$headings).'</td></tr>'; /* days and weeks vars now ... */ $running_day = date('w',mktime(0,0,0,$month,1,$year)); $days_in_month = date('t',mktime(0,0,0,$month,1,$year)); $days_in_this_week = 1; $day_counter = 0; $dates_array = array(); /* row for week one */ $calendar.= '<tr class="calendar-row">'; /* print "blank" days until the first of the current week */ for($x = 0; $x < $running_day; $x++): $calendar.= '<td class="calendar-day-np"> </td>'; $days_in_this_week++; endfor; /* keep going with days.... */ for($list_day = 1; $list_day <= $days_in_month; $list_day++): $calendar.= '<td class="calendar-day">'; /* add in the day number */ $calendar.= '<div class="day-number">'.$list_day.'</div>'; /** QUERY THE DATABASE FOR AN ENTRY FOR THIS DAY !! IF MATCHES FOUND, PRINT THEM !! **/ $calendar.= str_repeat('<p> </p>',2); $calendar.= '</td>'; if($running_day == 6): $calendar.= '</tr>'; if(($day_counter+1) != $days_in_month): $calendar.= '<tr class="calendar-row">'; endif; $running_day = -1; $days_in_this_week = 0; endif; $days_in_this_week++; $running_day++; $day_counter++; endfor; /* finish the rest of the days in the week */ if($days_in_this_week < 8): for($x = 1; $x <= (8 - $days_in_this_week); $x++): $calendar.= '<td class="calendar-day-np"> </td>'; endfor; endif; /* final row */ $calendar.= '</tr>'; /* end the table */ $calendar.= '</table>'; /* all done, return result */ return $calendar; } /* sample usages */ echo '<h2>July 2009</h2>'; echo draw_calendar(7,2009); echo '<h2>August 2009</h2>'; echo draw_calendar(8,2009); ?>

Here you find the average performance (time & memory) of each version. A grayed out version indicates it didn't complete successfully (based on exit-code).

VersionSystem time (s)User time (s)Memory (MiB)
8.3.60.0070.00718.55
8.3.50.0100.01018.30
8.3.40.0090.01218.90
8.3.30.0070.00718.94
8.3.20.0050.00320.33
8.3.10.0090.00020.43
8.3.00.0030.00519.38
8.2.180.0120.00416.50
8.2.170.0090.00622.96
8.2.160.0130.00318.89
8.2.150.0060.00324.18
8.2.140.0040.00424.66
8.2.130.0000.00826.16
8.2.120.0050.00322.23
8.2.110.0030.00722.03
8.2.100.0030.00917.91
8.2.90.0030.00619.46
8.2.80.0000.00817.97
8.2.70.0030.00618.00
8.2.60.0050.00318.03
8.2.50.0030.00619.60
8.2.40.0000.00818.47
8.2.30.0060.00618.26
8.2.20.0030.00518.07
8.2.10.0000.00718.36
8.2.00.0050.00317.94
8.1.280.0040.01125.92
8.1.270.0050.00322.27
8.1.260.0000.00826.35
8.1.250.0080.00028.09
8.1.240.0100.00623.69
8.1.230.0080.00419.22
8.1.220.0080.00018.03
8.1.210.0000.00818.77
8.1.200.0040.00517.38
8.1.190.0000.00817.38
8.1.180.0030.00718.10
8.1.170.0000.00818.76
8.1.160.0020.00522.11
8.1.150.0050.00319.01
8.1.140.0040.00417.71
8.1.130.0030.00317.98
8.1.120.0070.00017.71
8.1.110.0040.00417.59
8.1.100.0050.00317.57
8.1.90.0080.00017.71
8.1.80.0080.00017.66
8.1.70.0070.00017.56
8.1.60.0080.00017.71
8.1.50.0080.00017.73
8.1.40.0000.00817.55
8.1.30.0040.00417.71
8.1.20.0040.00417.70
8.1.10.0030.00617.65
8.1.00.0040.00417.55
8.0.300.0090.00018.77
8.0.290.0030.00617.00
8.0.280.0070.00018.63
8.0.270.0070.00017.34
8.0.260.0030.00317.33
8.0.250.0000.00717.12
8.0.240.0070.00017.16
8.0.230.0030.00317.19
8.0.220.0000.00717.16
8.0.210.0000.00717.11
8.0.200.0000.00617.23
8.0.190.0030.00617.11
8.0.180.0070.00017.10
8.0.170.0000.00817.11
8.0.160.0000.00717.06
8.0.150.0000.00817.05
8.0.140.0040.00417.00
8.0.130.0030.00313.41
8.0.120.0040.00417.10
8.0.110.0050.00217.03
8.0.100.0000.00817.01
8.0.90.0000.00717.16
8.0.80.0150.00617.11
8.0.70.0040.00417.08
8.0.60.0000.00716.94
8.0.50.0000.00817.17
8.0.30.0090.01317.26
8.0.20.0130.00917.41
8.0.10.0040.00417.25
8.0.00.0130.00716.96
7.4.330.0000.00615.06
7.4.320.0030.00316.56
7.4.300.0000.00616.59
7.4.290.0000.00716.76
7.4.280.0000.00916.67
7.4.270.0030.00316.67
7.4.260.0050.00316.73
7.4.250.0040.00416.72
7.4.240.0000.00816.77
7.4.230.0030.00316.83
7.4.220.0110.00716.87
7.4.210.0070.01416.78
7.4.200.0070.00016.48
7.4.160.0110.00616.74
7.4.150.0060.01217.40
7.4.140.0070.01117.86
7.4.130.0130.00516.79
7.4.120.0100.00716.89
7.4.110.0070.01016.71
7.4.100.0030.01416.63
7.4.90.0130.00616.64
7.4.80.0100.00719.37
7.4.70.0100.00916.56
7.4.60.0060.01116.68
7.4.50.0000.00816.57
7.4.40.0110.00716.80
7.4.30.0130.00516.87
7.4.10.0060.01315.13
7.4.00.0120.00515.32
7.3.330.0000.00513.46
7.3.320.0020.00313.29
7.3.310.0080.00016.28
7.3.300.0030.00316.38
7.3.290.0080.00616.47
7.3.280.0140.00216.47
7.3.270.0070.01117.40
7.3.260.0110.01116.68
7.3.250.0110.00916.76
7.3.240.0110.01516.88
7.3.230.0130.00716.60
7.3.210.0090.00916.57
7.3.200.0080.00819.39
7.3.190.0150.00416.73
7.3.180.0060.00916.54
7.3.170.0130.01116.51
7.3.160.0030.01416.91
7.3.130.0100.00715.01
7.3.120.0040.01215.28
7.3.110.0100.00715.01
7.3.100.0030.01014.86
7.3.90.0000.01815.09
7.3.80.0000.01314.93
7.3.70.0070.00715.10
7.3.60.0090.00315.29
7.3.50.0000.00914.90
7.3.40.0000.00915.02
7.3.30.0110.00414.76
7.3.20.0030.01516.87
7.3.10.0070.00716.61
7.3.00.0060.00316.96
7.2.330.0070.01016.77
7.2.320.0110.00717.07
7.2.310.0100.01316.83
7.2.300.0080.01217.14
7.2.290.0070.01016.90
7.2.260.0070.00415.11
7.2.250.0070.01115.43
7.2.240.0000.01415.33
7.2.230.0080.00415.37
7.2.220.0070.01115.08
7.2.210.0100.00715.19
7.2.200.0100.00315.00
7.2.190.0030.01015.43
7.2.180.0060.00915.33
7.2.170.0030.01015.18
7.2.160.0050.00514.93
7.2.150.0030.01417.04
7.2.140.0030.01517.04
7.2.130.0000.01017.09
7.2.120.0030.00617.12
7.2.110.0100.00717.02
7.2.100.0040.01116.79
7.2.90.0000.01417.23
7.2.80.0050.00817.00
7.2.70.0040.00717.07
7.2.60.0060.00917.08
7.2.50.0080.00317.02
7.2.40.0040.00916.88
7.2.30.0060.00316.93
7.2.20.0070.01016.93
7.2.10.0080.00817.20
7.2.00.0060.00617.07
7.1.330.0060.00616.02
7.1.320.0030.00915.67
7.1.310.0040.00815.89
7.1.300.0030.01015.87
7.1.290.0030.00515.79
7.1.280.0000.01215.63
7.1.270.0030.01015.59
7.1.260.0030.01015.87
7.1.250.0030.01016.05
7.1.240.0100.00315.98
7.1.230.0040.00715.70
7.1.220.0030.00915.96
7.1.210.0130.00015.62
7.1.200.0070.00515.89
7.1.190.0030.00716.05
7.1.180.0070.00716.01
7.1.170.0030.00615.79
7.1.160.0080.00315.88
7.1.150.0060.00315.91
7.1.140.0090.00615.88
7.1.130.0080.00616.04
7.1.120.0040.00716.02
7.1.110.0030.00915.68
7.1.100.0040.00715.77
7.1.90.0060.00915.94
7.1.80.0090.00015.84
7.1.70.0040.00416.46
7.1.60.0030.00917.57
7.1.50.0020.01516.57
7.1.40.0040.01115.94
7.1.30.0100.00315.88
7.1.20.0060.00616.03
7.1.10.0060.00615.91
7.1.00.0050.04319.15
7.0.330.0000.01515.41
7.0.320.0100.00315.38
7.0.310.0040.01115.57
7.0.300.0000.01215.44
7.0.290.0030.01015.44
7.0.280.0040.00715.30
7.0.270.0060.00615.63
7.0.260.0060.00315.50
7.0.250.0030.00915.59
7.0.240.0040.01115.32
7.0.230.0070.00715.33
7.0.220.0000.01215.65
7.0.210.0070.00715.31
7.0.200.0020.00816.20
7.0.190.0040.01115.65
7.0.180.0100.00615.55
7.0.170.0030.00915.62
7.0.160.0140.00015.46
7.0.150.0000.01515.39
7.0.140.0080.03918.88
7.0.130.0140.00415.56
7.0.120.0120.00315.50
7.0.110.0060.00315.62
7.0.100.0050.03017.77
7.0.90.0030.04017.67
7.0.80.0020.05017.76
7.0.70.0300.03817.87
7.0.60.0050.02517.76
7.0.50.0050.03917.95
7.0.40.0070.04416.82
7.0.30.0080.02916.82
7.0.20.0050.03516.81
7.0.10.0060.04816.87
7.0.00.0050.03016.72
5.6.400.0060.00614.55
5.6.390.0070.00714.38
5.6.380.0090.00614.66
5.6.370.0000.01014.48
5.6.360.0090.00914.40
5.6.350.0080.00814.71
5.6.340.0040.00414.64
5.6.330.0070.00714.35
5.6.320.0070.00714.47
5.6.310.0030.01314.73
5.6.300.0120.00314.29
5.6.290.0060.00614.47
5.6.280.0060.04117.78
5.6.270.0060.01214.64
5.6.260.0040.01214.33
5.6.250.0130.03017.66
5.6.240.0090.03517.43
5.6.230.0080.04417.55
5.6.220.0070.02717.58
5.6.210.0070.02717.63
5.6.200.0000.04617.81
5.6.190.0080.04217.57
5.6.180.0130.02617.79
5.6.170.0120.03817.72
5.6.160.0020.03017.72
5.6.150.0030.04017.72
5.6.140.0050.04417.67
5.6.130.0120.04317.77
5.6.120.0030.02817.90
5.6.110.0120.04017.73
5.6.100.0080.04517.76
5.6.90.0070.04717.78
5.6.80.0080.03217.44
5.6.70.0050.04417.66
5.6.60.0100.04317.49
5.6.50.0100.02317.37
5.6.40.0090.02517.42
5.6.30.0080.04717.52
5.6.20.0060.04317.29
5.6.10.0090.04017.36
5.6.00.0070.03217.44
5.5.380.0050.04217.36
5.5.370.0150.03717.32
5.5.360.0050.04617.37
5.5.350.0080.04517.36
5.5.340.0070.02317.71
5.5.330.0070.03017.76
5.5.320.0030.04517.76
5.5.310.0060.03917.71
5.5.300.0100.03517.51
5.5.290.0080.02517.73
5.5.280.0110.03117.71
5.5.270.0070.03017.70
5.5.260.0050.04817.50
5.5.250.0130.03717.38
5.5.240.0050.02317.43
5.5.230.0130.04017.40
5.5.220.0020.03417.31
5.5.210.0040.02917.16
5.5.200.0050.02917.20
5.5.190.0030.05617.22
5.5.180.0090.04517.29
5.5.170.0090.00614.36
5.5.160.0080.02717.35
5.5.150.0080.02617.33
5.5.140.0050.04317.09
5.5.130.0030.04317.19
5.5.120.0050.04417.26
5.5.110.0080.03517.28
5.5.100.0090.03217.32
5.5.90.0060.04217.13
5.5.80.0090.02217.08
5.5.70.0080.04217.16
5.5.60.0090.03817.16
5.5.50.0150.02217.16
5.5.40.0070.04017.32
5.5.30.0050.03917.24
5.5.20.0090.03717.04
5.5.10.0070.04217.12
5.5.00.0090.03017.19
5.4.450.0040.03516.18
5.4.440.0080.03616.04
5.4.430.0070.04316.16
5.4.420.0100.03516.06
5.4.410.0050.02916.10
5.4.400.0020.04416.04
5.4.390.0050.02915.88
5.4.380.0070.03816.01
5.4.370.0080.02115.92
5.4.360.0000.03515.90
5.4.350.0110.03716.01
5.4.340.0120.03715.87
5.4.330.0030.00912.90
5.4.320.0090.04015.96
5.4.310.0070.03816.01
5.4.300.0070.02216.03
5.4.290.0030.04316.01
5.4.280.0190.02815.96
5.4.270.0060.03416.03
5.4.260.0050.04515.97
5.4.250.0050.04116.05
5.4.240.0090.03716.01
5.4.230.0030.03516.01
5.4.220.0050.04215.88
5.4.210.0070.02515.90
5.4.200.0050.02815.97
5.4.190.0070.04216.06
5.4.180.0030.03016.03
5.4.170.0070.03816.06
5.4.160.0100.02115.96
5.4.150.0030.02816.01
5.4.140.0050.04014.63
5.4.130.0100.02514.68
5.4.120.0090.03314.65
5.4.110.0050.03314.66
5.4.100.0070.03514.69
5.4.90.0090.02014.62
5.4.80.0030.02914.61
5.4.70.0070.04014.68
5.4.60.0100.03614.65
5.4.50.0070.03514.65
5.4.40.0090.01714.63
5.4.30.0050.03014.69
5.4.20.0070.04214.63
5.4.10.0070.04314.61
5.4.00.0050.03914.38
5.3.290.0170.03314.82
5.3.280.0070.08714.68
5.3.270.0170.06714.71
5.3.260.0030.08014.65
5.3.250.0030.08314.68
5.3.240.0100.07014.63
5.3.230.0070.07014.58
5.3.220.0130.06714.64
5.3.210.0070.04314.57
5.3.200.0100.07314.72
5.3.190.0070.06714.57
5.3.180.0000.04714.62
5.3.170.0030.07014.51
5.3.160.0030.06714.64
5.3.150.0130.04314.58
5.3.140.0100.03014.66
5.3.130.0030.04714.65
5.3.120.0030.07714.49
5.3.110.0070.07714.49
5.3.100.0100.08714.08
5.3.90.0170.06714.13
5.3.80.0130.04313.97
5.3.70.0000.05013.97
5.3.60.0030.07314.02
5.3.50.0070.08013.97
5.3.40.0030.06713.97
5.3.30.0100.03013.86
5.3.20.0070.03713.77
5.3.10.0000.03713.65
5.3.00.0070.03313.76
5.2.170.0100.04711.60
5.2.160.0070.05011.60
5.2.150.0030.04711.60
5.2.140.0030.03011.60
5.2.130.0030.02711.60
5.2.120.0070.02711.60
5.2.110.0100.02011.60
5.2.100.0170.02011.60
5.2.90.0030.04011.60
5.2.80.0070.02711.60
5.2.70.0000.03711.60
5.2.60.0070.02711.60
5.2.50.0000.03311.60
5.2.40.0130.02011.60
5.2.30.0070.02311.60
5.2.20.0000.03011.60
5.2.10.0030.02011.60
5.2.00.0030.02311.60
5.1.60.0000.02011.60
5.1.50.0000.02711.60
5.1.40.0000.02711.60
5.1.30.0000.03011.60
5.1.20.0000.02711.60
5.1.10.0100.03311.60
5.1.00.0030.02711.60
5.0.50.0000.02011.60
5.0.40.0030.03711.60
5.0.30.0000.03011.60
5.0.20.0030.02011.60
5.0.10.0000.02311.60
5.0.00.0030.03011.60
4.4.90.0030.01311.60
4.4.80.0000.01711.60
4.4.70.0000.01711.60
4.4.60.0000.01311.60
4.4.50.0070.01011.60
4.4.40.0000.02311.60
4.4.30.0000.03011.60
4.4.20.0000.01711.60
4.4.10.0000.03711.60
4.4.00.0030.02311.60
4.3.110.0000.01711.60
4.3.100.0030.01311.60
4.3.90.0030.02011.60
4.3.80.0070.02011.60
4.3.70.0000.01711.60
4.3.60.0000.01311.60
4.3.50.0000.01711.60
4.3.40.0000.02311.60
4.3.30.0030.01311.60
4.3.20.0000.01711.60
4.3.10.0000.01311.60
4.3.00.0030.01311.60

preferences:
56.24 ms | 400 KiB | 5 Q