3v4l.org

run code in 300+ PHP versions simultaneously
<?php class day{ public $date; public function __construct() { $this->date = time(); } /** * Should I write code today? * @param (array) $todos Current list of TODOs * @return boolean I should code if true. */ public function doCode($todos) { //return true; //Never stop coding $chore = next($todos); while($chore && $chore->priority < 3 ) $chore = next($todos); return $chore === false || $this->isWeekend($this->date); } /** * Is the date in teh weekend? * @param string $date String date to check * @return boolean True if date is in the weekend */ public function isWeekend($date) { return date('w', strtotime($date)) % 6 == 0; } } /* End of file day.php */ /* Location: ./life/modules/day/day.php */ $agenda = array( (object)array('priority'=>1) ,(object)array('priority'=>4) ,(object)array('priority'=>1) ,(object)array('priority'=>5) ); $day = new day(); $i = 1; while($i< 10) { echo var_dump($day->isWeekend($day->date)) . "\n"; $day->date = strtotime($day->date. ' + 1 days'); $i++; }

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)
7.3.10.0030.01416.71
7.3.00.0120.00816.35
7.2.130.0170.00316.88
7.2.120.0120.00617.26
7.2.110.0110.00417.09
7.2.100.0070.01117.08
7.2.90.0030.01517.16
7.2.80.0090.00916.80
7.2.70.0030.01017.21
7.2.60.0130.00417.14
7.2.50.0120.00916.98
7.2.40.0170.00316.90
7.2.30.0100.01017.30
7.2.20.0100.01016.81
7.2.10.0150.00416.72
7.2.00.0100.00418.48
7.1.250.0040.00816.01
7.1.240.0000.01715.97
7.1.230.0130.00715.69
7.1.220.0030.01015.63
7.1.210.0180.00315.57
7.1.200.0100.00716.03
7.1.190.0120.00616.02
7.1.180.0180.00015.99
7.1.170.0070.00716.05
7.1.160.0110.01115.70
7.1.150.0100.01015.99
7.1.140.0140.00316.12
7.1.130.0150.00615.66
7.1.120.0130.00715.66
7.1.110.0080.01215.89
7.1.100.0050.01117.24
7.1.90.0140.00615.98
7.1.80.0080.01215.70
7.1.70.0090.00416.73
7.1.60.0090.01017.55
7.1.50.0100.01216.61
7.1.40.0030.01015.89
7.1.30.0140.00316.01
7.1.20.0180.00015.89
7.1.10.0130.00615.48
7.1.00.0050.02319.32
7.0.330.0070.01115.19
7.0.320.0030.01015.23
7.0.310.0120.00615.69
7.0.300.0100.00715.43
7.0.290.0070.01015.48
7.0.280.0070.00715.18
7.0.270.0120.00615.27
7.0.260.0100.00715.24
7.0.250.0130.00515.25
7.0.240.0070.01015.45
7.0.230.0080.00815.50
7.0.220.0090.00315.51
7.0.210.0070.01115.23
7.0.200.0070.00516.16
7.0.190.0140.00315.62
7.0.180.0060.01215.52
7.0.170.0040.01115.42
7.0.160.0070.01115.49
7.0.150.0130.00315.65
7.0.140.0060.04118.80
7.0.130.0030.01315.43
7.0.120.0090.00615.18
7.0.110.0150.00415.39
7.0.100.0110.04317.72
7.0.90.0070.04517.67
7.0.80.0070.04717.76
7.0.70.0090.04517.68
7.0.60.0120.03717.70
7.0.50.0070.04817.99
7.0.40.0050.04616.73
7.0.30.0100.03616.86
7.0.20.0080.03816.67
7.0.10.0150.02816.78
7.0.00.0080.04616.87
5.6.380.0090.00314.68
5.6.370.0110.00814.19
5.6.360.0080.01214.13
5.6.350.0140.00714.12
5.6.340.0140.00914.73
5.6.330.0180.00814.55
5.6.320.0120.01214.64
5.6.310.0190.00714.66
5.6.300.0180.00614.09
5.6.290.0100.01214.48
5.6.280.0100.03817.73
5.6.270.0170.00314.55
5.6.260.0150.00914.68
5.6.250.0200.03217.63
5.6.240.0100.03317.70
5.6.230.0090.04017.51
5.6.220.0100.04317.47
5.6.210.0150.03817.58
5.6.200.0150.03917.79
5.6.190.0040.04917.66
5.6.180.0150.03517.68
5.6.170.0050.04317.66
5.6.160.0140.04317.74
5.6.150.0060.05317.69
5.6.140.0150.04217.89
5.6.130.0170.04217.76
5.6.120.0130.03917.84
5.6.110.0070.04717.81
5.6.100.0110.03017.83
5.6.90.0050.04317.69
5.6.80.0110.04617.28
5.6.70.0070.04317.24
5.6.60.0080.04817.50
5.6.50.0100.04517.50
5.6.40.0110.04517.47
5.6.30.0090.02617.44
5.6.20.0080.04817.34
5.6.10.0110.04117.28
5.6.00.0120.04317.30
5.5.380.0070.04215.92
5.5.370.0130.04216.05
5.5.360.0120.02215.91
5.5.350.0080.04715.80
5.5.340.0080.04416.05
5.5.330.0020.03716.08
5.5.320.0110.03715.94
5.5.310.0080.04316.08
5.5.300.0000.04616.12
5.5.290.0090.04016.00
5.5.280.0100.02516.11
5.5.270.0060.03916.07
5.5.260.0130.04016.04
5.5.250.0060.03315.99
5.5.240.0100.04715.55
5.5.230.0070.04315.56
5.5.220.0050.03015.68
5.5.210.0110.03815.78
5.5.200.0060.03915.51
5.5.190.0080.02115.80
5.5.180.0050.02515.68
5.5.170.0110.00411.05
5.5.160.0020.03515.60
5.5.150.0130.03715.51
5.5.140.0130.03715.73
5.5.130.0050.03815.75
5.5.120.0090.02315.70
5.5.110.0050.02415.43
5.5.100.0050.04615.68
5.5.90.0070.04115.50
5.5.80.0020.04415.40
5.5.70.0090.04215.61
5.5.60.0110.04215.62
5.5.50.0080.04015.55
5.5.40.0050.04515.52
5.5.30.0050.03415.74
5.5.20.0060.03815.80
5.5.10.0100.03815.57
5.5.00.0100.03815.73
5.4.450.0050.04315.25
5.4.440.0090.02915.31
5.4.430.0120.02515.31
5.4.420.0030.04115.31
5.4.410.0100.03815.27
5.4.400.0030.02815.11
5.4.390.0090.02115.06
5.4.380.0020.03915.00
5.4.370.0030.02515.18
5.4.360.0050.02615.04
5.4.350.0100.02214.94
5.4.340.0110.03714.82
5.4.330.0110.00411.18
5.4.320.0090.04115.11
5.4.310.0110.03715.11
5.4.300.0110.03614.95
5.4.290.0080.03815.24
5.4.280.0080.04215.01
5.4.270.0120.02715.04
5.4.260.0080.01915.22
5.4.250.0060.04315.08
5.4.240.0060.03515.25
5.4.230.0100.03115.22
5.4.220.0070.04315.17
5.4.210.0060.04014.96
5.4.200.0100.03714.88
5.4.190.0060.04315.13
5.4.180.0070.03915.07
5.4.170.0090.03215.27
5.4.160.0100.03514.97
5.4.150.0080.03215.05
5.4.140.0080.03413.94
5.4.130.0050.02213.59
5.4.120.0030.04013.75
5.4.110.0030.02613.86
5.4.100.0090.02813.71
5.4.90.0030.03813.92
5.4.80.0030.04413.86
5.4.70.0090.03813.75
5.4.60.0040.04313.77
5.4.50.0020.03213.74
5.4.40.0040.03913.81
5.4.30.0050.04113.84
5.4.20.0040.03913.75
5.4.10.0080.03013.72
5.4.00.0080.03113.32
5.3.290.0070.04012.93
5.3.280.0030.02912.62
5.3.270.0070.04012.76
5.3.260.0070.02612.80
5.3.250.0060.02512.71
5.3.240.0060.03912.69
5.3.230.0080.03512.64
5.3.220.0070.03512.70
5.3.210.0090.03712.66
5.3.200.0110.03112.60
5.3.190.0070.04112.72
5.3.180.0090.04112.76
5.3.170.0060.03612.72
5.3.160.0080.03412.69
5.3.150.0080.02812.77
5.3.140.0070.03012.77
5.3.130.0070.04112.63
5.3.120.0030.03512.72
5.3.110.0030.04312.69
5.3.100.0070.04012.29
5.3.90.0080.02812.35
5.3.80.0050.03912.49
5.3.70.0070.03712.39
5.3.60.0130.03312.46
5.3.50.0030.03812.29
5.3.40.0030.04312.40
5.3.30.0130.03512.28
5.3.20.0080.03912.23
5.3.10.0070.03812.09
5.3.00.0020.02711.97
5.2.170.0090.01610.48
5.2.160.0080.01510.54
5.2.150.0060.03010.57
5.2.140.0070.02810.48
5.2.130.0030.03310.37
5.2.120.0060.02810.50
5.2.110.0020.03510.35
5.2.100.0070.02010.36
5.2.90.0140.01510.30
5.2.80.0050.03110.38
5.2.70.0020.02410.20
5.2.60.0030.03410.35
5.2.50.0030.03510.30
5.2.40.0050.03210.32
5.2.30.0040.02710.26
5.2.20.0090.02710.27
5.2.10.0100.02710.19
5.2.00.0030.02710.12
5.1.60.0080.0129.71
5.1.50.0050.0179.64
5.1.40.0100.0239.69
5.1.30.0050.0239.90
5.1.20.0070.0159.84
5.1.10.0070.0189.79
5.1.00.0030.0309.68
5.0.50.0010.0269.00
5.0.40.0050.0128.95
5.0.30.0050.0158.86
5.0.20.0030.0238.86
5.0.10.0040.0158.79
5.0.00.0030.0368.74
4.4.90.0030.0127.94
4.4.80.0000.0217.94
4.4.70.0050.0167.94
4.4.60.0020.0197.94
4.4.50.0020.0137.94
4.4.40.0020.0177.94
4.4.30.0040.0177.94
4.4.20.0030.0157.94
4.4.10.0030.0137.94
4.4.00.0000.0287.94
4.3.110.0020.0097.94
4.3.100.0020.0117.94
4.3.90.0020.0127.94
4.3.80.0030.0267.94
4.3.70.0020.0207.94
4.3.60.0030.0187.94
4.3.50.0030.0187.94
4.3.40.0040.0257.94
4.3.30.0030.0157.94
4.3.20.0030.0187.94
4.3.10.0020.0117.94
4.3.00.0010.0207.94

preferences:
44.48 ms | 401 KiB | 5 Q