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', $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.4.10.0040.01816.83
7.4.00.0100.01016.52
7.3.130.0060.01316.64
7.3.120.0030.01616.79
7.3.110.0040.01216.76
7.3.100.0030.01316.85
7.3.90.0070.01016.72
7.3.80.0120.00016.63
7.3.70.0070.00716.52
7.3.60.0130.00316.75
7.3.50.0070.00416.61
7.3.40.0030.01216.48
7.3.30.0100.00616.47
7.3.20.0090.00318.49
7.3.10.0070.01118.41
7.3.00.0060.01018.35
7.2.260.0100.01016.95
7.2.250.0070.01117.04
7.2.240.0070.01016.71
7.2.230.0110.00416.58
7.2.220.0080.00416.93
7.2.210.0030.01017.02
7.2.200.0060.01216.80
7.2.190.0110.00716.90
7.2.180.0030.01016.79
7.2.170.0060.00616.85
7.2.160.0030.01016.95
7.2.150.0030.00918.63
7.2.140.0090.00318.63
7.2.130.0100.00718.82
7.2.120.0000.01518.71
7.2.110.0000.01218.58
7.2.100.0060.00618.54
7.2.90.0070.01018.50
7.2.80.0070.00617.81
7.2.70.0080.00818.44
7.2.60.0060.01017.87
7.2.50.0070.01118.48
7.2.40.0070.00718.84
7.2.30.0080.00818.69
7.2.20.0000.01118.49
7.2.10.0110.00418.54
7.2.00.0090.00519.16
7.1.330.0000.01317.58
7.1.320.0070.00717.58
7.1.310.0110.00017.52
7.1.300.0060.00917.57
7.1.290.0000.01317.52
7.1.280.0060.00917.80
7.1.270.0000.01417.48
7.1.260.0110.00017.50
7.1.250.0030.00917.57
7.1.240.0070.00717.65
7.1.230.0120.00617.55
7.1.220.0040.01517.62
7.1.210.0040.00717.63
7.1.200.0050.00816.81
7.1.190.0040.01117.65
7.1.180.0070.01017.55
7.1.170.0030.00717.57
7.1.160.0110.00417.49
7.1.150.0060.00617.57
7.1.140.0030.00917.51
7.1.130.0000.00917.59
7.1.120.0030.00717.41
7.1.110.0130.00317.57
7.1.100.0020.01118.00
7.1.90.0000.01017.68
7.1.80.0080.00417.47
7.1.70.0110.00017.35
7.1.60.0050.01418.29
7.1.50.0030.01417.50
7.1.40.0000.01417.54
7.1.30.0100.00717.70
7.1.20.0030.00917.61
7.1.10.0030.00717.71
7.1.00.0020.02519.95
7.0.330.0080.00317.14
7.0.320.0030.01217.17
7.0.310.0060.00616.99
7.0.300.0070.00417.40
7.0.290.0060.00317.34
7.0.280.0040.01117.30
7.0.270.0120.00017.14
7.0.260.0060.00817.38
7.0.250.0070.00717.38
7.0.240.0110.00417.13
7.0.230.0030.00717.09
7.0.220.0070.00717.24
7.0.210.0040.01117.37
7.0.200.0090.00317.00
7.0.190.0000.00917.04
7.0.180.0060.00617.32
7.0.170.0070.00717.23
7.0.160.0070.01017.13
7.0.150.0030.00617.27
7.0.140.0030.04119.61
7.0.130.0080.00817.21
7.0.120.0070.00717.27
7.0.110.0080.00717.09
7.0.100.0100.00717.20
7.0.90.0060.01217.17
7.0.80.0230.02018.54
7.0.70.0200.02418.53
7.0.60.0300.04418.60
7.0.50.0390.04018.74
7.0.40.0050.04017.50
7.0.30.0080.02717.68
7.0.20.0050.03817.68
7.0.10.0060.03917.59
7.0.00.0100.02817.66
5.6.400.0060.00816.46
5.6.390.0060.01216.19
5.6.380.0050.00816.19
5.6.370.0060.00616.10
5.6.360.0040.00716.16
5.6.350.0070.01416.19
5.6.340.0060.00616.38
5.6.330.0000.01516.20
5.6.320.0080.00816.02
5.6.310.0000.01016.14
5.6.300.0070.01016.11
5.6.290.0120.00316.37
5.6.280.0080.00416.14
5.6.270.0040.01116.00
5.6.260.0130.00316.05
5.6.250.0110.00316.18
5.6.240.0130.00616.01
5.6.230.0030.02518.38
5.6.220.0090.03718.42
5.6.210.0060.04418.36
5.6.200.0090.04318.61
5.6.190.0070.04518.62
5.6.180.0080.04618.54
5.6.170.0130.03118.48
5.6.160.0050.02718.46
5.6.150.0050.04718.54
5.6.140.0030.04818.67
5.6.130.0030.04918.66
5.6.120.0050.04618.62
5.6.110.0030.02918.56
5.6.100.0050.05118.61
5.6.90.0030.03518.49
5.6.80.0120.03518.29
5.6.70.0030.03218.27
5.6.60.0030.03918.29
5.6.50.0030.02918.14
5.6.40.0050.03218.18
5.6.30.0030.04118.26
5.6.20.0070.02718.22
5.6.10.0080.03818.19
5.6.00.0090.04018.21
5.5.380.0100.00616.22
5.5.370.0030.02618.30
5.5.360.0080.04118.26
5.5.350.0110.03018.23
5.5.340.0070.02918.41
5.5.330.0020.03518.44
5.5.320.0100.03818.43
5.5.310.0070.04318.52
5.5.300.0090.04918.46
5.5.290.0030.04618.49
5.5.280.0050.04418.44
5.5.270.0080.04018.54
5.5.260.0090.02918.48
5.5.250.0070.04218.27
5.5.240.0040.02718.13
5.5.230.0100.02018.19
5.5.220.0070.02518.14
5.5.210.0120.02018.15
5.5.200.0050.03817.94
5.5.190.0050.02418.08
5.5.180.0060.04018.17
5.5.170.0100.00716.07
5.5.160.0050.02817.95
5.5.150.0070.03018.08
5.5.140.0090.01718.07
5.5.130.0090.03218.03
5.5.120.0080.02717.96
5.5.110.0050.03318.08
5.5.100.0080.03517.98
5.5.90.0080.03618.11
5.5.80.0120.03818.09
5.5.70.0080.03818.08
5.5.60.0080.03818.04
5.5.50.0100.03717.99
5.5.40.0070.04217.94
5.5.30.0050.04217.93
5.5.20.0080.02518.12
5.5.10.0060.03317.85
5.5.00.0070.04018.06
5.4.450.0060.03016.56
5.4.440.0080.02516.50
5.4.430.0090.02116.49
5.4.420.0110.03116.57
5.4.410.0050.04616.50
5.4.400.0010.02316.49
5.4.390.0030.02516.43
5.4.380.0020.02516.43
5.4.370.0130.03216.41
5.4.360.0070.04016.40
5.4.350.0050.02616.47
5.4.340.0080.04016.45
5.4.330.0070.00313.77
5.4.320.0050.02116.41
5.4.310.0050.01716.44
5.4.300.0010.04816.33
5.4.290.0030.02716.47
5.4.280.0080.02716.48
5.4.270.0040.02616.45
5.4.260.0080.03816.30
5.4.250.0050.04216.32
5.4.240.0090.02416.44
5.4.230.0070.03916.40
5.4.220.0030.04416.40
5.4.210.0030.04216.43
5.4.200.0070.03516.46
5.4.190.0100.04216.50
5.4.180.0050.04316.46
5.4.170.0050.03016.31
5.4.160.0060.02616.43
5.4.150.0120.03216.49
5.4.140.0070.04115.14
5.4.130.0060.01815.11
5.4.120.0030.03115.15
5.4.110.0070.02015.12
5.4.100.0080.03515.09
5.4.90.0070.04115.13
5.4.80.0030.04115.12
5.4.70.0030.04015.04
5.4.60.0030.04215.14
5.4.50.0100.03315.09
5.4.40.0080.03815.07
5.4.30.0050.02415.12
5.4.20.0050.04015.08
5.4.10.0050.03815.06
5.4.00.0030.04214.81
5.3.290.0030.03114.25
5.3.280.0080.03814.15
5.3.270.0070.03714.17
5.3.260.0070.04214.26
5.3.250.0070.03914.21
5.3.240.0030.04414.19
5.3.230.0050.03814.15
5.3.220.0070.03014.14
5.3.210.0020.04714.18
5.3.200.0030.03614.17
5.3.190.0050.04314.22
5.3.180.0070.04014.17
5.3.170.0070.02814.14
5.3.160.0080.03614.24
5.3.150.0010.04614.20
5.3.140.0040.03114.21
5.3.130.0020.03314.15
5.3.120.0080.03814.16
5.3.110.0020.04614.23
5.3.100.0100.03413.90
5.3.90.0070.02513.88
5.3.80.0100.03013.93
5.3.70.0100.04013.95
5.3.60.0090.04013.88
5.3.50.0050.03913.86
5.3.40.0030.03413.87
5.3.30.0050.03813.91
5.3.20.0030.04413.79
5.3.10.0050.03413.73
5.3.00.0090.03413.69
5.2.170.0070.05711.02
5.2.160.0000.04011.20
5.2.150.0100.05711.21
5.2.140.0030.06711.18
5.2.130.0100.06011.12
5.2.120.0070.05711.11
5.2.110.0030.06311.16
5.2.100.0030.06311.22
5.2.90.0070.06311.03
5.2.80.0070.04311.17
5.2.70.0030.06011.12
5.2.60.0000.05711.11
5.2.50.0030.06010.94
5.2.40.0100.02310.90
5.2.30.0100.04310.90
5.2.20.0070.05710.90
5.2.10.0030.04710.90
5.2.00.0030.06010.90
5.1.60.0030.05710.90
5.1.50.0070.03310.90
5.1.40.0000.04710.90
5.1.30.0030.03010.90
5.1.20.0070.05710.90
5.1.10.0000.05710.90
5.1.00.0070.05010.90
5.0.50.0000.04310.90
5.0.40.0000.04710.90
5.0.30.0130.05710.90
5.0.20.0030.03710.90
5.0.10.0000.04310.90
5.0.00.0000.06710.90
4.4.90.0030.03310.90
4.4.80.0030.02010.90
4.4.70.0000.03710.90
4.4.60.0070.03310.90
4.4.50.0030.03310.90
4.4.40.0030.04710.90
4.4.30.0070.03310.90
4.4.20.0000.03710.90
4.4.10.0100.01710.90
4.4.00.0030.05310.90
4.3.110.0000.03710.90
4.3.100.0030.03310.90
4.3.90.0070.03010.90
4.3.80.0030.03710.90
4.3.70.0000.02710.90
4.3.60.0030.03310.90
4.3.50.0030.03310.90
4.3.40.0070.05310.90
4.3.30.0070.02710.90
4.3.20.0000.02310.90
4.3.10.0000.02010.90
4.3.00.0030.03310.90

preferences:
42.12 ms | 401 KiB | 5 Q