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 */ protected 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.4.10.0070.01015.16
7.4.00.0070.01415.09
7.3.130.0070.00714.77
7.3.120.0060.01014.84
7.3.110.0030.01015.04
7.3.100.0070.00714.74
7.3.90.0030.01014.93
7.3.80.0000.00814.73
7.3.70.0070.00714.74
7.3.60.0100.00314.66
7.3.50.0030.00514.37
7.3.40.0110.00414.89
7.3.30.0000.00914.74
7.3.20.0040.00816.55
7.3.10.0070.00716.47
7.3.00.0070.00716.40
7.2.260.0060.00915.16
7.2.250.0100.01015.12
7.2.240.0060.00915.30
7.2.230.0120.00615.13
7.2.220.0090.00615.02
7.2.210.0000.01114.98
7.2.200.0040.00914.78
7.2.190.0060.01015.00
7.2.180.0030.00714.76
7.2.170.0060.00915.00
7.2.160.0110.00715.08
7.2.150.0070.00317.02
7.2.140.0070.00316.74
7.2.130.0070.01016.54
7.2.120.0060.01216.68
7.2.110.0060.00616.72
7.2.100.0060.01116.93
7.2.90.0080.00317.04
7.2.80.0040.00816.73
7.2.70.0040.01116.96
7.2.60.0070.00716.93
7.2.50.0120.00316.67
7.2.40.0030.01316.75
7.2.30.0100.00616.93
7.2.20.0100.00616.84
7.2.10.0100.00717.07
7.2.00.0040.01218.08
7.1.330.0100.00315.80
7.1.320.0090.00615.66
7.1.310.0060.00615.73
7.1.300.0030.01215.74
7.1.290.0070.00715.79
7.1.280.0030.00515.73
7.1.270.0040.00415.74
7.1.260.0060.00315.74
7.1.250.0060.01215.69
7.1.240.0000.01415.74
7.1.230.0130.00015.60
7.1.220.0090.00615.84
7.1.210.0000.01215.75
7.1.200.0110.00815.73
7.1.190.0070.00315.82
7.1.180.0030.00915.73
7.1.170.0100.00415.80
7.1.160.0000.01515.91
7.1.150.0070.00415.84
7.1.140.0030.01315.84
7.1.130.0060.00815.89
7.1.120.0080.00815.88
7.1.110.0080.00815.91
7.1.100.0060.00917.14
7.1.90.0060.00615.76
7.1.80.0040.01215.86
7.1.70.0040.00816.43
7.1.60.0050.01317.45
7.1.50.0100.01016.39
7.1.40.0030.01215.78
7.1.30.0100.00615.75
7.1.20.0030.01515.55
7.1.10.0130.00315.68
7.1.00.0110.03319.14
7.0.330.0000.01515.11
7.0.320.0100.00715.44
7.0.310.0110.00415.37
7.0.300.0110.00315.31
7.0.290.0040.01115.25
7.0.280.0080.00315.45
7.0.270.0040.00715.31
7.0.260.0000.01415.29
7.0.250.0060.00915.50
7.0.240.0060.00615.54
7.0.230.0070.01015.55
7.0.220.0000.01015.42
7.0.210.0030.01315.55
7.0.200.0000.01116.07
7.0.190.0090.00615.45
7.0.180.0030.00915.29
7.0.170.0030.00915.59
7.0.160.0070.01015.43
7.0.150.0060.01015.33
7.0.140.0050.03618.70
7.0.130.0080.00815.14
7.0.120.0050.00315.48
7.0.110.0040.01115.20
7.0.100.0070.02017.59
7.0.90.0150.03317.67
7.0.80.0070.04317.65
7.0.70.0050.04517.47
7.0.60.0060.04217.64
7.0.50.0130.04117.80
7.0.40.0080.04016.79
7.0.30.0060.04516.77
7.0.20.0080.04516.75
7.0.10.0050.04516.76
7.0.00.0080.04316.82
5.6.400.0040.01113.92
5.6.390.0060.00914.27
5.6.380.0030.01014.34
5.6.370.0070.00714.60
5.6.360.0160.00014.24
5.6.350.0070.00714.12
5.6.340.0000.01314.13
5.6.330.0060.00914.46
5.6.320.0040.01114.38
5.6.310.0040.01114.50
5.6.300.0100.00714.33
5.6.290.0000.01014.66
5.6.280.0030.04017.65
5.6.270.0000.01114.04
5.6.260.0060.00614.42
5.6.250.0020.02517.37
5.6.240.0060.04217.50
5.6.230.0090.03517.59
5.6.220.0090.02717.48
5.6.210.0030.04517.45
5.6.200.0080.04317.55
5.6.190.0100.04217.68
5.6.180.0100.04317.88
5.6.170.0050.02817.59
5.6.160.0110.02517.72
5.6.150.0040.05117.74
5.6.140.0030.04317.81
5.6.130.0050.03317.68
5.6.120.0140.03217.87
5.6.110.0100.02917.65
5.6.100.0120.04017.68
5.6.90.0050.04617.64
5.6.80.0080.04017.51
5.6.70.0050.02917.24
5.6.60.0080.04117.34
5.6.50.0090.04317.34
5.6.40.0020.04017.41
5.6.30.0040.02717.32
5.6.20.0050.02817.38
5.6.10.0120.02017.34
5.6.00.0050.04717.32
5.5.380.0070.03217.47
5.5.370.0070.03717.31
5.5.360.0050.04117.37
5.5.350.0020.03917.29
5.5.340.0090.04217.51
5.5.330.0060.03017.65
5.5.320.0070.04317.50
5.5.310.0030.04717.60
5.5.300.0050.03717.65
5.5.290.0050.04917.67
5.5.280.0160.01917.34
5.5.270.0020.05217.51
5.5.260.0020.05017.51
5.5.250.0030.04817.57
5.5.240.0050.04617.08
5.5.230.0040.03017.07
5.5.220.0100.03817.15
5.5.210.0020.04217.03
5.5.200.0070.02317.02
5.5.190.0090.03817.11
5.5.180.0050.04517.14
5.5.170.0040.01114.17
5.5.160.0080.04017.21
5.5.150.0080.04317.18
5.5.140.0030.03617.17
5.5.130.0060.04517.29
5.5.120.0070.04317.15
5.5.110.0130.03817.36
5.5.100.0050.04717.07
5.5.90.0090.04217.15
5.5.80.0070.04517.14
5.5.70.0120.03217.11
5.5.60.0050.03217.18
5.5.50.0020.04716.93
5.5.40.0080.04317.18
5.5.30.0070.02617.15
5.5.20.0000.05217.23
5.5.10.0100.04017.08
5.5.00.0090.02217.06
5.4.450.0050.03315.33
5.4.440.0110.03615.24
5.4.430.0030.04515.31
5.4.420.0100.04215.27
5.4.410.0060.02615.26
5.4.400.0060.02814.97
5.4.390.0100.03715.04
5.4.380.0100.02714.91
5.4.370.0060.03715.19
5.4.360.0030.03315.14
5.4.350.0030.04714.90
5.4.340.0050.04315.15
5.4.330.0070.00311.00
5.4.320.0050.04315.09
5.4.310.0110.03515.08
5.4.300.0070.04314.94
5.4.290.0070.02514.83
5.4.280.0100.02314.86
5.4.270.0100.04014.93
5.4.260.0080.03914.95
5.4.250.0070.02215.15
5.4.240.0050.02815.05
5.4.230.0110.03815.02
5.4.220.0070.04315.20
5.4.210.0070.02515.06
5.4.200.0080.04015.08
5.4.190.0090.03915.00
5.4.180.0040.04315.03
5.4.170.0070.03915.05
5.4.160.0080.02514.99
5.4.150.0050.03315.03
5.4.140.0050.04213.60
5.4.130.0000.04313.62
5.4.120.0090.02813.57
5.4.110.0090.03713.71
5.4.100.0080.03813.68
5.4.90.0020.04113.69
5.4.80.0050.03813.63
5.4.70.0050.02513.57
5.4.60.0020.02313.80
5.4.50.0050.02813.61
5.4.40.0070.03313.57
5.4.30.0060.04013.74
5.4.20.0020.04113.67
5.4.10.0080.03813.84
5.4.00.0130.03213.54
5.3.290.0070.04512.81
5.3.280.0080.03912.66
5.3.270.0070.03912.65
5.3.260.0060.03512.64
5.3.250.0050.04012.66
5.3.240.0120.03512.54
5.3.230.0050.03812.59
5.3.220.0020.02712.58
5.3.210.0000.03912.54
5.3.200.0030.03312.46
5.3.190.0060.02412.45
5.3.180.0050.02012.64
5.3.170.0030.04212.57
5.3.160.0060.02312.74
5.3.150.0130.03512.73
5.3.140.0060.03912.54
5.3.130.0090.03212.59
5.3.120.0040.03212.50
5.3.110.0040.04412.64
5.3.100.0080.03912.42
5.3.90.0120.03312.27
5.3.80.0080.03812.32
5.3.70.0040.03412.22
5.3.60.0040.03412.36
5.3.50.0090.03712.37
5.3.40.0050.03412.22
5.3.30.0040.03812.32
5.3.20.0020.04412.05
5.3.10.0050.03812.09
5.3.00.0020.04212.04
5.2.170.0100.06011.38
5.2.160.0030.03311.38
5.2.150.0030.06711.38
5.2.140.0000.06011.38
5.2.130.0070.06011.38
5.2.120.0030.06011.38
5.2.110.0030.06311.38
5.2.100.0030.06311.38
5.2.90.0030.06711.38
5.2.80.0000.06311.38
5.2.70.0030.06011.38
5.2.60.0030.06711.38
5.2.50.0030.06311.38
5.2.40.0030.06011.38
5.2.30.0100.05711.38
5.2.20.0100.04011.38
5.2.10.0030.05711.38
5.2.00.0070.06311.38
5.1.60.0030.05311.38
5.1.50.0030.05311.38
5.1.40.0070.05011.38
5.1.30.0030.05311.38
5.1.20.0000.05311.38
5.1.10.0000.06011.38
5.1.00.0000.06011.38
5.0.50.0100.03711.38
5.0.40.0000.04711.38
5.0.30.0100.06011.38
5.0.20.0000.05011.38
5.0.10.0000.04011.38
5.0.00.0030.06711.38
4.4.90.0030.03311.38
4.4.80.0070.03011.38
4.4.70.0100.03011.38
4.4.60.0070.02311.38
4.4.50.0030.03311.38
4.4.40.0000.05311.38
4.4.30.0000.03311.38
4.4.20.0000.03711.38
4.4.10.0070.03011.38
4.4.00.0000.05311.38
4.3.110.0030.02711.38
4.3.100.0070.03011.38
4.3.90.0030.02311.38
4.3.80.0030.04011.38
4.3.70.0030.03311.38
4.3.60.0130.02711.38
4.3.50.0070.02311.38
4.3.40.0000.05311.38
4.3.30.0000.03711.38
4.3.20.0000.03311.38
4.3.10.0000.03711.38
4.3.00.0000.03711.38

preferences:
39.89 ms | 401 KiB | 5 Q